Find Duplicate Submitted Jobs JDE
WITH CTE(JCEXEHOST,JCFNDFUF2, duplicatecount)
AS (SELECT JCEXEHOST,JCFNDFUF2, ROW_NUMBER() OVER(PARTITION BY JCEXEHOST,JCFNDFUF2 ORDER BY JCEXEHOST,JCFNDFUF2) AS DuplicateCount
FROM SVM920.F986110 WHERE JCJOBSTS IN ('W') AND JCORGHOST='Enterprise_Server')
SELECT * FROM CTE WHERE DuplicateCount > 1;
Delete Duplicate Submitted Jobs JDE
WITH CTE(JCEXEHOST,JCFNDFUF2, duplicatecount)
AS (SELECT JCEXEHOST,JCFNDFUF2, ROW_NUMBER() OVER(PARTITION BY JCEXEHOST,JCFNDFUF2 ORDER BY JCEXEHOST,JCFNDFUF2) AS DuplicateCount
FROM SVM920.F986110 WHERE JCJOBSTS IN ('W') AND JCORGHOST='Enterprise_Server')
DELETE FROM CTE WHERE DuplicateCount > 1;