Re: Complex select

2009-07-07 Thread Viktor Semykin
Tim Chase wrote: > but Django lets you drop to raw SQL pretty easily, > so it shouldn't be a big deal. Thanks. I think I will stop on raw SQL. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: Complex select

2009-07-07 Thread Tim Chase
> Something like this: > Query = Comments.objects.all().sort_by("submit_date")[:5] Without having the models, it's a little difficult to judge what the OP is after. However, the difference is that your version gets you the top 5 *comments*. The OP appears to want the top 5 unique "object_pk"

Re: Complex select

2009-07-07 Thread djangou...@gmail.com
Something like this: Query = Comments.objects.all().sort_by("submit_date")[:5] -- Sent from my Palm Pre Viktor Semykin wrote: Hi everyone. I'm trying to create comment overview page. I want to select all content entries that were recently commented. The problem is that I don't know how to do th

Complex select

2009-07-07 Thread Viktor Semykin
Hi everyone. I'm trying to create comment overview page. I want to select all content entries that were recently commented. The problem is that I don't know how to do that. In SQL I would run something like select distinct object_pk from (select * from django_comments order by submit_date desc)