What would be the best way to shorten the following SQL Snippet:
SELECT a.ViewCount, b.DateCreated
FROM (SELECT COUNT(*) AS ViewCount
FROM UserViewHistory uvh1
WHERE (UserID = @UserID) AND (ViewedByUserID = @RequestingUserID)) AS a,
(SELECT TOP (1) DateCreated
FROM UserViewHistory uvh2
WHERE (UserID = @UserID) AND (ViewedByUserID = @RequestingUserID)
ORDER BY DateCreated DESC) b
The idea of the query is the pull the lastviewed date and also the number of views in total - it works as it is, but I was wondering if there was a better way?
Thanks in advance.