Order distinct 1 specifieke kolom


SELECT  TOP 5 *
FROM    (SELECT dbo.tbl_forums.ForumID, dbo.tbl_messages.Date, dbo.tbl_forums.Forum,
                ROW_NUMBER() OVER (PARTITION BY dbo.tbl_forums.Forum ORDER BY dbo.tbl_messages.Date DESC) AS RowNumber
         FROM   dbo.tbl_messages INNER JOIN
                      dbo.tbl_forums ON dbo.tbl_messages.ForumID = dbo.tbl_forums.ForumID)
AS a
WHERE   a.RowNumber = 1
ORDER BY Date DESC