79148574

Date: 2024-11-01 15:37:04
Score: 2.5
Natty:
Report link

I had to set Max(date) to maxdate to get David's code to work for me in MS SQL Server

SELECT t1.username, t1.date, value FROM MyTable as t1 INNER JOIN (SELECT username, MAX(date) as maxdate FROM MyTable GROUP BY username) as t2 ON t2.username = t1.username AND t2.maxdate = t1.date

Reasons:
  • Low length (0.5):
  • No code block (0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: John Kosanovic