This is my current query:
SELECT
u.UserName, s.StatusName
FROM
UserStatus us
JOIN Status s on s.StatusId = us.StatusID
JOIN Users u on u.UserId = us.UserId
WHERE
us.UserId in (select UserId from Users)
AND us.DateCreated > '2017-07-14 00:00:00.000'
ORDER BY
us.DateCreated desc
It returns this:
How would I get only the most recent status for each user?
EDIT:
I can't just do SELECT TOP 2
because I don't know how many users there are going to be. There might be 500. There might be 10.