标准的分组 Mysql,取的分组所有数据:
select * from table where id = id group by id order by id desc limit 1,1;
当使用分组取数量时,先取的所有分组,然后取数量:
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;
当对分组组内内容排序和分组排序使用,各自排序:
select * from (select * from table order by id desc) as g where id = id group by id order by id desc limit 1,1;