首页 > 数据库技术 > 详细

mysql分组用法

时间:2017-05-26 11:32:02      阅读:303      评论:0      收藏:0      [点我收藏+]
--select num from 表 group by num
--select num from 表 group by num,nid


--特别的:group by 必须在where之后,order by之前
--select num,nid from 表  where nid > 10 group by num,nid order by nid desc


-- group by是关键
-- 可接多个分组的判断条件
--select num,nid,count(*),sum(score),max(score),min(score) from 表 group by num,nid


--select num from 表 group by num having max(id) > 10

  

mysql分组用法

原文:http://www.cnblogs.com/dengyg200891/p/6907630.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!