Sql group by 分组取时间最新的一条数据

with MiPriceTopOne as (
select classid,max(dataTime) dataTime,max(id) as id from MiPrice group by classid
)
select * from MiPrice where id in (select id from MiPriceTopOne)

posted @ 2016-04-02 23:19  老皆知  阅读(7835)  评论(0编辑  收藏  举报