score:3

Accepted answer
SELECT
     P.*
FROM
     dbo.GetTableFromIDList(@id_list) U
INNER JOIN Workplans WP1 ON
     WP1.UserID = U.ID
LEFT OUTER JOIN dbo.Workplans WP2 ON
     WP2.UserID = WP1.UserID AND
     WP2.Date > WP1.Date
INNER JOIN dbo.Projects P ON
     P.WorkplanID = WP1.WorkplanID
WHERE
     WP2.WorkplanID IS NULL

Related Query

More Query from same tag