標準的分組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