Wednesday, May 4, 2011


DISTINCT columns need to be specified in the SELECT field because of Postgres limitations.

The reason every field in the table is included is because that's how
GROUP BY works - any field that is in the query that isn't an
aggregate needs to be included in the group by. When you call
Table.objects...., this implies SELECT,, ... at
the database level. Some other fields are included in the GROUP BY to
accomodate the needs of order_by() and select_related().

No comments:

Post a Comment