sql 分组后按时间降序排列再取出每组的第一条记录

select * from (select ROW_NUMBER()over(partition by  id order by rTime desc) rowId,*
from  Records where Uid=353) as Records 
where rowId=1

原文地址:https://www.cnblogs.com/itclw/p/15357527.html