--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