Let’s suppose I have a table as such:
ID | Date | Owner | Activity
----------------------------------------
1 | 1/2/2011 | Joe | Login
2 | 2/1/2011 | Mary | Logout
1 | 2/3/2011 | Bob | Process
3 | 5/6/2010 | Harry | Send
2 | 8/1/2011 | Alice | Hide
How can I run a query that retrieves all values but for the date field I have the max(date) for that id for EACH entry.
Thus if I were to select * (with other statements I don’t yet know how to run) the output would be:
ID | Date | Owner | Activity
----------------------------------------
1 | 2/3/2011 | Joe | Login
2 | 8/1/2011 | Mary | Logout
1 | 2/3/2011 | Bob | Process
3 | 5/6/2010 | Harry | Send
2 | 8/1/2011 | Alice | Hide
An
INNER JOINon a subquery grouping by ID to return theMAX(Date)should do the job: