sqlserver中删除重复数据

WITH CTE AS (
  SELECT License,DataTime, 
         ROW_NUMBER() OVER(PARTITION BY License,DataTime ORDER BY (SELECT 0)) AS RN
  FROM GasOff where PollutionSiteCode = 'C410526005' and DataTime >= '2024-04-10'
)
select * FROM CTE WHERE RN > 1
--delete FROM CTE WHERE RN > 1

 

posted @ 2024-04-10 16:19  木子zzgxl  阅读(2)  评论(0编辑  收藏  举报