CREATE TABLE `test` (
`id` int NULL ,
`name` varchar(255) NULL ,
`type` tinyint NULL ,
`date` datetime NULL ,
PRIMARY KEY (`id`)
)
select * from (select * from test tb1 order by date desc) tb2 group by tb2.type
;
亲测可用!!性能挺好的。。有问题大家可用交流!
CREATE TABLE `test` (
`id` int NULL ,
`name` varchar(255) NULL ,
`type` tinyint NULL ,
`date` datetime NULL ,
PRIMARY KEY (`id`)
)
select * from (select * from test tb1 order by date desc) tb2 group by tb2.type
;
亲测可用!!性能挺好的。。有问题大家可用交流!
转载于:https://my.oschina.net/ericyang/blog/693894