LOADING XQ STUDIO
logo

【SQL Server】实现有多条记录ID相同,取时间最近的一条

  • authorAdmin
  • 来源:csdn
  • 2022/08/09 09:03:42
  • (2)
select *
  From (Select 
                 fs.id
                 ,fs.other
                 ,ROW_NUMBER() Over 
                         (Partition by fs.id --指定记录的ID
                            order by fs.updatetime DESC  --时间优先级
                          ) Fsp From Storage AS fs
                 ) AS Storage
  Where Fsp = 1

整站搜索