如何获取订购超过15次的客户列表。 我有customerId,orderId,orderValue,orderDate。
我尝试了
select * from customertable Group By customerId having count (*) > 15
答案 0 :(得分:2)
您可以在下面尝试-
select customerid
from customertable
Group By customerId having count (distinct orderid) >= 15
答案 1 :(得分:0)
SELECT customerid, COUNT(*) counter
FROM customertable
GROUP BY customerId HAVING counter >= 15