Changes between Version 1 and Version 2 of Ticket #23557, comment 1
- Timestamp:
- Sep 26, 2014, 6:54:38 PM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #23557, comment 1
v1 v2 7 7 http://dev.mysql.com/doc/refman/5.0/en/group-by-extensions.html describes the logic behind not requiring columns in the group by statement, but calls out that queries are non-deterministic unless the "free" column is unique for the group. This is a foot gun as far as I'm concerned, unless you *really* know what you're doing. I think it applies more to hand crafted queries rather than queries generated from an ORM. 8 8 9 It also looks like columns in the ORDER BY that aren't referenced in the GROUP BY have no affect, except possibly choosing a deterministic value for the "free" column in the select list, which django doesn't support anyway.9 "Furthermore, the selection of values from each group cannot be influenced by adding an ORDER BY clause. Sorting of the result set occurs after values have been chosen, and ORDER BY does not affect which values within each group the server chooses." So ORDER BY has no effect on the results, unless the column is returned as part of the query.