with T1 as ( SELECT ROW_NUMBER() over (PARTITION By MachineCode order by ABS(DATEDIFF(MILLISECOND,‘2019-12-10 13:21:32.162‘ ,[Time]))) as rowid,* FROM EnergyConsumptions ) select * from T1 where rowid=1
2024-01-12 11:34:10
with T1 as ( SELECT ROW_NUMBER() over (PARTITION By MachineCode order by ABS(DATEDIFF(MILLISECOND,‘2019-12-10 13:21:32.162‘ ,[Time]))) as rowid,* FROM EnergyConsumptions ) select * from T1 where rowid=1
下一篇:SQL批量删除数据