+----+---------+---------+---------------------+
| id | user_id | game_id | time_stamp |
+----+---------+---------+---------------------+
| 37 | 000u1 | 000g1 | 2013-04-08 10:35:30 |
| 38 | 000u2 | 000g2 | 2013-04-08 10:35:30 |
| 39 | 000u3 | 000g3 | 2013-04-08 10:35:30 |
| 40 | 000u4 | 000g4 | 2013-04-08 10:35:30 |
| 41 | 000u5 | 000g5 | 2013-04-08 10:35:31 |
| 42 | 000u6 | 000g6 | 2013-04-08 10:35:31 |
| 43 | 000u7 | 000g7 | 2013-04-08 10:35:31 |
| 44 | 000u8 | 000g8 | 2013-04-08 10:35:31 |
| 45 | 000u9 | 000g9 | 2013-04-08 10:35:31 |
| 46 | 000u0 | 000g0 | 2013-04-23 14:25:00 |
+----+---------+---------+---------------------+
I need user_id and game_id based on max time_stamp;
select * from GameClientModels_time_stamp where time_stamp in (select
max(time_stamp) from GameClientModels_time_stamp);
Help to convert above sql query to django model query.
I am trying below mentioned way but is not working
times = time_stamp.objects.values('user_id').aggregate(Max('time_stamp'))
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.