我想過濾掉小於3的結果,但每當我添加WHERE語句時查詢失敗。我的查詢出了什麼問題?我正在使用MySQL Workbench 3.7SQL WHERE不會過濾我的結果
SELECT c.name, COUNT(DISTINCT s.product_id) AS veggies
FROM sales AS s
INNER JOIN customers AS c
ON c.id=s.customer_id
GROUP BY s.customer_id
WHERE veggies > 2"
謝謝! 號Yoni
查詢必須符合語法 – Strawberry