MySQL Forums
Forum List  »  Quality Assurance

GROUP BY alias
Posted by: Alex Lapin
Date: October 05, 2007 04:40AM

My problem is related to
http://bugs.mysql.com/bug.php?id=14019

I used quoted expression aliases in GROUP BY statement in version 5.0.27 and it stopped working since I upgraded to version 5.0.37.

How to repeat:
CREATE TABLE t (version varchar(20));
INSERT t VALUES ('1.0'), (''), ('2.0'), ('N/A');
SELECT IF(version REGEXP '^[0-9.]+$', version, 'undefined') AS 'version', COUNT(*) AS 'count' FROM t GROUP BY 'version';

Result is:
+---------+-------+
| version | count |
+---------+-------+
| 1.0 | 4 |
+---------+-------+

In 5.0.27 it was:
+-----------+-------+
| version | count |
+-----------+-------+
| 1.0 | 1 |
| 2.0 | 1 |
| undefined | 2 |
+-----------+-------+

I believe those changes (Bug #14019) were wrongful.

Options: ReplyQuote


Subject
Views
Written By
Posted
GROUP BY alias
4655
October 05, 2007 04:40AM


Sorry, you can't reply to this topic. It has been closed.

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.