Hi! I have model with some field: person_id - Integer, service_id - Integer, datetime - DateTime (timestamp) and some other.
How can I get all _LATEST BY datetime field_ services for person_id = 130960 ?? I have to get only: 2 | 2007-12-25 16:15:20.006126+02 3 | 2007-12-25 16:15:20.006126+02 4 | 2007-12-25 16:15:20.006126+02 75 | 2007-12-25 16:15:20.006126+02 103 | 2007-12-25 16:15:20.006126+02 rows. Thank you! eps=> SELECT service_id, datetime FROM organizations_organizationdatabase WHERE person_id = 130960 ORDER BY datetime DESC, service_id; service_id | datetime ----------------+------------------------------- 2 | 2007-12-25 16:15:20.006126+02 3 | 2007-12-25 16:15:20.006126+02 4 | 2007-12-25 16:15:20.006126+02 75 | 2007-12-25 16:15:20.006126+02 103 | 2007-12-25 16:15:20.006126+02 103 | 2007-12-05 14:05:01.927051+02 4 | 2007-12-05 14:03:53.101003+02 3 | 2007-12-05 14:02:03.500237+02 75 | 2007-12-05 14:00:50.846234+02 2 | 2007-12-05 13:59:17.384326+02 103 | 2007-12-01 11:05:01.827051+02 2 | 2007-12-01 11:03:53.201003+02 3 | 2007-12-01 11:02:03.600237+02 75 | 2007-12-01 11:00:50.846234+02 4 | 2007-12-01 10:59:17.884326+02 (15 rows) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---