I have a large data-set of emails sent and status-codes.
ID Recipient Date Status
1 someone@example.com 01/01/2010 1
2 someone@example.com
SELECT
M.Recipient,
C.EmailCount,
M.Status
FROM
(
SELECT Recipient, Count(*) EmailCount
FROM Messages
GROUP BY Recipient
) C
JOIN
(
SELECT Recipient, MAX(Date) AS LastDate
FROM Messages
GROUP BY Recipient
) MD ON C.Recipient = MD.Recipient
JOIN
Messages M ON MD.Recipient = M.Recipient AND MD.LastDate = M.Date
ORDER BY
Recipient
I've found aggregates mostly scale better then ranking functions