Sql group by 分組取時間最新的一條資料

老皆知發表於2016-04-02

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)

相關文章