I have a table which I want to get the latest entry for each group. Here\'s the table:
DocumentStatusLogs Table
DocumentStatusLogs
|ID| DocumentID | Status
This is the most vanilla TSQL I can come up with
SELECT * FROM DocumentStatusLogs D1 JOIN ( SELECT DocumentID,MAX(DateCreated) AS MaxDate FROM DocumentStatusLogs GROUP BY DocumentID ) D2 ON D2.DocumentID=D1.DocumentID AND D2.MaxDate=D1.DateCreated