Bug #80131 The 'group' statement has changed it's behaviour in 5.7.10
| Submitted: | 24 Jan 2016 21:05 | Modified: | 1 Feb 2016 15:43 |
|---|---|---|---|
| Reporter: | sammy esmail | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: Optimizer | Severity: | S1 (Critical) |
| Version: | 5.7.10 | OS: | Windows (i) |
| Assigned to: | CPU Architecture: | Any |
[24 Jan 2016 21:05]
sammy esmail
[25 Jan 2016 14:51]
sammy esmail
The behaviour of "group by" in 5.7.10 has changed from 5.6.28. "group by xyz" extracted the first element from each group based on entry into the database. However, this seems not to work on "group b" operating on a subquery like: select * from ( select * from table group by date desc, time desc ) as A group by some_field. The new table that group should operate on should be 'A' and not 'table'. "group by" rather still operates table.
[31 Jan 2016 20:43]
sammy esmail
It has been brought to my attention that the reference manual states that it is "indeterminate" as to which member of the list is returned by the "group by". All I can state is that it is a very nice feature it is was made determinate. It seems that it was very deterministic since 5.1. So this is not bug but the right of MySQL to exercise its right to change the behavior.
[1 Feb 2016 15:43]
MySQL Verification Team
Hi Sammy, Yes, you are quite right. This is a change of behavior introduced in 5.7. So, if you need your results ordered, just use ORDER BY, after GROUP BY. This change was made in order to keep in line with ANSI SQL standards. Not a bug.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.