You sure this ain't homework...and your desired result set I think is incorrectUSE NorthwindGOSET NOCOUNT ONCREATE TABLE myTable99(PrjID int, EmpID int, [Date] datetime, PrjName char(2))GOINSERT INTO myTable99(PrjID, EmpID, [Date], PrjName)SELECT 1, 1, '10/01/2004', 'P1' UNION ALLSELECT 2, 2, '08/02/2004', 'P2' UNION ALLSELECT 3, 2, '11/12/2004', 'P3' UNION ALLSELECT 4, 2, '05/05/2004', 'P5' UNION ALLSELECT 5, 3, '05/30/2004', 'P6' UNION ALLSELECT 6, 3, '09/10/2004', 'P7'GOSELECT * FROM myTable99 o WHERE EXISTS (SELECT * FROM myTable99 i GROUP BY EmpId HAVING MAX(i.[Date]) = o.[Date] AND i.EmpID = o.EmpID)GOSET NOCOUNT OFFDROP TABLE myTable99GO
Brett8-)