mysql分組用法

--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
相關文章
相關標籤/搜索