Yeah, you are right. Actually I'm trying to get most actual (latest by timestamp) records per group.
2012/2/10 Dennis Lee Bieber <wlfr...@ix.netcom.com>: > On Fri, 10 Feb 2012 02:39:33 +0200, ???? ?????? > <kamikaze.is.waiting....@gmail.com> wrote: > >>Is it possible to write ORM-way request to be same as this SQL: >>SELECT mo.* FROM (SELECT mi.* FROM my_model mi) AS mo WHERE mi.a=mo.a >>AND mi.b=mo.b; >> >>There is also an agregation+group by statements in subselect, but let's >>assume that we don't have them. >> > I'm going to guess that the aggregation and group by portions are > what makes a subselect needed... Otherwise the SQL would be the almost > meaningless: > > select mo.* from my_model as mo > inner join my_model as mi > on mo.a = mi.a and mo.b = mi.b > -- > Wulfraed Dennis Lee Bieber AF6VN > wlfr...@ix.netcom.com HTTP://wlfraed.home.netcom.com/ > > -- > 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+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.