Since there is no aggregate on your outer select, the GROUP BY is basically reduced to a DISTINCT, so we can just do a distinct() on the query set. The JOINs come automatically as soon as you have ForeignKey fields (just remember to do a select_related() to avoid excessive queries there). The max(status.id) inner select -- you can't get a subselect automatically, so you'll have to manually specify that in an extra(where=...) to generate it.
Cheers,
mjl
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment