SQL一些关键字
2018-07-18 本文已影响4人
shenyoujian
SQL一些常用的关键字
1、Having,跟where一样用于过滤但是where用于过滤行,而having用于过滤分组。
#列出至少有两个订单的所有顾客
select cust_id, count(*) as orders from orders group by cust_id having
count(*) >=2;
#列出至少有两个订单的所有顾客
select cust_id, count(*) as orders from orders group by cust_id having
count(*) >=2;