美文网首页
分组数据

分组数据

作者: 骑着白龙马的猪八戒 | 来源:发表于2019-08-05 10:17 被阅读0次

    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

    相关文章

      网友评论

          本文标题:分组数据

          本文链接:https://www.haomeiwen.com/subject/ahowrctx.html