Get latest updated records

前端 未结 5 1817
旧时难觅i
旧时难觅i 2020-12-22 03:00

I have an \"Observation\" table in SQL Server 2008. This table has a locationId column for a bunch of geographic locations, a few columns for observation details and a colum

5条回答
  •  自闭症患者
    2020-12-22 03:05

    select a.* from observations a inner join 
    (select locationid ,max(updateddate) dates  from observations
    group by locationid) b
    on a.locationid=b.locationid
    and a.updateddate=b.dates  
    

提交回复
热议问题