MYSQL 分组

标准的分组Mysql,取的分组全部数据: select * from table where id = id group by id order by id desc limit 1,1;sql

当使用分组取数量时,先取的全部分组,而后取数量: sleect count() from (select count() from table where id = id group by id order by id desc limit 1,1) as g;排序

当对分组组内内容排序时,先对数据排序,而后分组取的排序后的数据: select * from (select * from table order by id desc) as g where id = id group by id limit 1,1;it

当对分组组内内容排序和分组排序使用,各自排序: select * from (select * from table order by id desc) as g where id = id group by id order by id desc limit 1,1;table

相关文章
相关标签/搜索