I want to write a T-SQL statement to find duplicate record when dates are matched to the same month and year.
I managed to find duplicates if dates are exactly the same in Ms Access using this:
SELECT
First(dbo_T_TrainingMandatory.StaffID) AS [StaffID Field],
First(dbo_T_TrainingMandatory.TrainingCourseID) AS [TrainingCourseID Field],
First(dbo_T_TrainingMandatory.DateTrained) AS [DateTrained Field],
COUNT(dbo_T_TrainingMandatory.StaffID) AS NumberOfDups
FROM dbo_T_TrainingMandatory
GROUP BY dbo_T_TrainingMandatory.StaffID,
dbo_T_TrainingMandatory.TrainingCourseID,
dbo_T_TrainingMandatory.DateTrained
HAVING (((COUNT(dbo_T_TrainingMandatory.StaffID)) > 1)
AND ((COUNT(dbo_T_TrainingMandatory.DateTrained)) > 1));
But haven't found a solution when the day of the month are different.