To identify multiple records in a table following is a sample query to execute:
SELECT PERSONNELNUMBER, ATTENDANCEDATE, COUNT(*)
FROM SLJMGATTENDANCETABLE
GROUP BY PERSONNELNUMBER, ATTENDANCEDATE
HAVING COUNT(*) >1;
Following SQL code, will delete all the duplicate records, meaning by it will keep only one record, where by the extra copy will be deleted:
WITH CTE AS
(
SELECT *, ROW_NUMBER() OVER (PARTITION BY WORKER, ATTENDANCEDATE, TIME ORDER BY WORKER, ATTENDANCEDATE, TIME) AS RN
FROM SLJMGATTENDANCEEXCELDATA
)
DELETE FROM CTE WHERE RN<>1