0
我正在使用mysql,但需要在配置單元上覆制一些查詢。蜂巢:尋找客戶從交易中一起購買的商品
我有一個表,這個表格
我想檢索以下信息:
在MySQL,下面的查詢工作:
SELECT c.original_item_id, c.bought_with_item_id, count(*) as times_bought_together
FROM (
SELECT a.item_id as original_item_id, b.item_id as bought_with_item_id
FROM items a
INNER join items b
ON a.transaction_id = b.transaction_id AND a.item_id != b.item_id where original_item_id in ('B','C')) c
GROUP BY c.original_item_id, c.bought_with_item_id;
但我不是能夠將此轉換爲蜂巢查詢,我已經嘗試了很多洗牌連接,並在條件下替換了哪裏,但沒有得到必要的結果。如果我可以在此找到一些幫助,會很好。