Try:
SELECT DocID, EmployeeID, DocumentType, ExpDate
FROM Documents AS A
WHERE ExpDate = (SELECT MAX(B.ExpDate)
FROM Documents AS B
WHERE B.EmployeeID = A.EmployeeID
AND B.DocumentType = A.DocumentType);
On SQL Server 2005:
SELECT DocID, EmployeeID, DocumentType, ExpDate
FROM (SELECT DocID, EmployeeID, DocumentType, ExpDate,
ROW_NUMBER() OVER(PARTITION BY EmployeeID, DocumentType
ORDER BY ExpDate DESC) AS
seq
FROM Documents) AS T
WHERE seq = 1;
HTH,
Plamen Ratchev
http://www.SQLStudio.com