Wednesday, September 14, 2011

Re: order by + group by

On 09/14/2011 11:37 AM, Иван Иванов wrote:
> The problem here is, like Peter said, that you cannot order before
> grouping. And that's very annoying.

Of course you can, using a subselect just like I showed. SQLite example:

> .schema
CREATE TABLE a (name varchar, mod int);

e> select * from a;
b1|1
b1|2
b1|3

> select * from a group by name;
b1|3

> select * from (select * from a order by mod desc) group by name;
b1|1

--
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate