Due to an error in the system a tracking log was firing repeatedly causing what should have been one log entry to actually be in the hundreds. This has been resolved but the data is still there and needs to be for reporting (I can't just deleted it all). However I only want ONE instance of the data. This is going to be tricky I think, here are the relevant fields in the table:
int UserID, int ActorID, nvarchar(50) ActorType, int BoxID, datetime CreateDate, nvarchar(50) Query
Now for every row where all of those are identical and the difference in the CreateDate is within say, 30 seconds of each other, I want to delete all those rows but one.
So all the data in the fields listed will be exactly matched and the CreateDate will range like:
2010-08-17 14:50:11.620
2010-08-17 14:50:11.823
2010-08-17 14:50:12.057
2010-08-17 14:50:12.277
2010-08-17 14:50:12.527
2010-08-17 14:50:12.730
2010-08-17 14:50:12.980
2010-08-17 14:50:13.340
2010-08-17 14:50:13.450
2010-08-17 14:50:13.667
2010-08-17 14:50:13.887
2010-08-17 14:50:14.120
2010-08-17 14:50:14.323
2010-08-17 14:50:14.730
2010-08-17 14:50:14.807
2010-08-17 14:50:15.010
2010-08-17 14:50:15.357
...
2010-08-17 14:51:09.810
2010-08-17 14:51:10.047
2010-08-17 14:51:10.250
2010-08-17 14:51:10.500
2010-08-17 14:51:10.890
2010-08-17 14:51:10.953
2010-08-17 14:51:11.263
2010-08-17 14:51:11.437
2010-08-17 14:51:11.920
2010-08-17 14:51:12.170
2010-08-17 14:51:12.217
2010-08-17 14:51:12.420
2010-08-17 14:51:12.670
2010-08-17 14:51:12.873
2010-08-17 14:51:13.123
2010-08-17 14:51:13.373
2010-08-17 14:51:13.577
2010-08-17 14:51:13.797
2010-08-17 14:51:14.030
2010-08-17 14:51:14.280
2010-08-17 15:29:19.180
2010-08-17 15:32:32.497
2010-08-17 15:32:32.733
2010-08-17 15:32:32.967
2010-08-17 15:32:33.263
2010-08-17 15:32:33.513
2010-08-17 15:32:33.623
2010-08-17 15:32:33.857
2010-08-17 15:32:34.140
2010-08-17 15:32:34.327
2010-08-17 15:32:34.560
2010-08-17 15:32:34.780
2010-08-17 15:32:35.043
2010-08-17 15:32:35.247
2010-08-17 15:32:35.483
2010-08-17 15:32:35.717
But I just one to keep one, I hope that is enough information.