I have the following database in PostgreSQL:
How do I select from the table activity-history-tracking the last tracking of a user?
id username      date tracking
------------------------------
1  Aaron     2/1/2010 1600
2  Freddy    3/1/2010 2000
3  Jimin     8/4/2009 3000
4  Brad      2/2/2010 4000
5  Gus      12/2/2009 1000
...
In activity-history-follow-up the history (follow-up) of the users is stored daily.
The following didn't work:
SELECT *
FROM(Select
    user_id,
    Max(date) as lastActivity
    from "activity-historic-tracked"
    Group By user_id) as result
GROUP BY user_id, lastActivity

 
     
    