WITH cte AS (
SELECT child_code,
row_number() OVER(PARTITION BY child_code ORDER BY child_code) AS 'Duplicatecount'
FROM SDMIS_STUDENT_MASTER_18_19 where SchoolRegNo='1234567' and Class=6
and isnull(child_code,'')<>'')
DELETE cte WHERE Duplicatecount > 1
SELECT child_code,
row_number() OVER(PARTITION BY child_code ORDER BY child_code) AS 'Duplicatecount'
FROM SDMIS_STUDENT_MASTER_18_19 where SchoolRegNo='1234567' and Class=6
and isnull(child_code,'')<>'')
DELETE cte WHERE Duplicatecount > 1
No comments:
Post a Comment