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