分组返回数据,不是where的那种返回特定数据
select vend_id, count(*) as num_prods from products group by vend_id;
按vend_id字段分组,然后统计总数返回数据
select cust_id, count(*) as orders
from orders
group by cust_id
having count(*) >= 2;
筛选出需要数据
where过滤行,having过滤分组
原文:https://www.cnblogs.com/chenzhuantou/p/11658191.html