SQL Server 查询 Row_Number() OVER去重
SELECT * FROM (SELECT ID_SEQ,ID_SIM,DATEDIFF(s, '1970-01-01 00:00:00', DT_GPSDATETIME) AS DT_GPSDATETIMES,NM_LONGITUDE,NM_LATITUDE,NM_SPEED,NM_DIRECTION,NM_HEIGHT,Text3,Cells,Mileage,Row_Number() OVER(partition by ID_SIM ORDER BY ID_SEQ DESC) ct FROM [dbo].[t_gps20211105] WHERE [ID_SIM] IN ('1440564626072') ) AS temp_gps WHERE temp_gps.ct=1
评论已关闭