group by 创建分组 出现在where子句之后,order by子句之前
having
select vend_id,count(*) as num_prods from products group by vend_id;
GROUP BY语句只是MYSQL按照vend_id排序并分组
排序和分组
mysql> select order_num,sum(quantity*item_price) as ordertotal from orderitems group by order_num having sum(quantity*item_price)>=50
网友评论