How to delete duplicate rows from table if they are written in a minute period?

I have a SQL Server table with the following data:

TriggerId  TableName     EmployerCode   CreatedDate               UserInfo     OperationName
   9       Employeers    834320         2020-08-06 16:05:13.427   GRP\Office1  Update
  10       Employeers    834320         2020-08-06 16:05:13.480   GRP\Office1  Update
  11       Employeers    834320         2020-08-06 16:07:13.480   GRP\Office1  Update

I need to "clean" the table removing duplicate rows written in a specific period of time (one minute).

The duplication is defined by four columns:

TableName, EmployerCode, UserInfo, OperationName

So in the example only line 10 has to be removed because it is a duplicate of line 9.

Read more here:

Content Attribution

This content was originally published by Igor at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: