Unfortunately the dates are done in short dates and when it comes down to the records having the same dates and times, I need to delete the record that was entered first. Maybe by using min ID. Not sure how to do that Here is the SQL. I can't put data here
select twr.Id, GETDATE(),null, 1, 9, 'Terminated', 'Newer Agreement Became Effective. This was a system-initiated event.', 0
from tblTWRecord twr
join tblTWRecord twr2 on twr.EmployeeId = twr2.EmployeeId
and (twr.StartDate < twr2.StartDate
or (twr.StartDate = twr2.StartDate and twr.DateSubmitted < twr2.DateSubmitted))
where CAST(twr2.StartDate as date) <= CAST(GETDATE() as date) and twr.StatusId not in (8,9,10)
and (twr2.StatusId = 4 or twr2.StatusId = 11)