哪位顾客在我们的商店购买了4件或更多商品?
SELECT cutomer.cusName, COUNT(itemName) AS 'Number of items'
FROM customer INNER JOIN store
ON customer.cusID = store.cusID
GROUP BY cutomer.cusName;
我不确定如何输出哪个顾客购买了4件或更多物品。
答案 0 :(得分:0)
添加HAVING
条款以吸引购买4件或更多商品的客户
SELECT cutomer.cusName, COUNT(itemName) AS 'Number of items'
FROM customer INNER JOIN store
ON customer.cusID = store.cusID
GROUP BY cutomer.cusName
HAVING count(itemName) >=4