I have a SQL table that has a number of fields including these two:
EmpID char(6)
EffDate datetime
There can be 1 or many EmpId's. What I am trying to do is find a simple way to delete all the duplicate EmpID's except the one with the most recent EffDate. For example, if this were my data:
000001 7/5/2005
000002 6/30/2005
000002 7/15/2005
000003 7/10/2005
I would want only these rows remaining after my delete:
000001 7/5/2005
000002 7/15/2005
000003 7/10/2005
Could someone help me with the SQL statement to accomplish this?
Thanks!
EmpID char(6)
EffDate datetime
There can be 1 or many EmpId's. What I am trying to do is find a simple way to delete all the duplicate EmpID's except the one with the most recent EffDate. For example, if this were my data:
000001 7/5/2005
000002 6/30/2005
000002 7/15/2005
000003 7/10/2005
I would want only these rows remaining after my delete:
000001 7/5/2005
000002 7/15/2005
000003 7/10/2005
Could someone help me with the SQL statement to accomplish this?
Thanks!