首页 > 代码库 > Row_Number()取最近的一条数据

Row_Number()取最近的一条数据

select * from GSS_User where uid in (select UserId from ( select *, ROW_NUMBER() over(partition by UserId order by [Date] desc) a from GSS_User_RedPacketTaskRecord) as ss where a = 1 )

 

Row_Number()取最近的一条数据