Bug #979 GROUP_CONCAT not giving any results when using ORDER BY <numeric field>

Submitted: 1 Aug 2003 9:01 Modified: 3 Aug 2003 4:33
Reporter: Stefan Haacker Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.0-alpha-log OS:Linux (Suse Linux 8.2 Professional)
Assigned to: CPU Architecture:Any

[1 Aug 2003 9:01] Stefan Haacker
Description:
When trying to use GROUP_CONCAT and sorting the results by a field containing numeric values I get an empty result in the GROUP_CONCAT column.

How to repeat:
Create a Table using this:
CREATE TABLE test_se (
  id int(10) unsigned NOT NULL auto_increment,
  engine varchar(100) NOT NULL default '',
  query varchar(255) NOT NULL default '',
  num_q int(11) NOT NULL default '0',
  PRIMARY KEY  (id)
) TYPE=MyISAM;

Now trying the following query gives me an empty result in the engine column:

mysql> SELECT query, sum(num_q) as all_q, group_concat( engine ORDER BY engine SEPARATOR ', ') FROM test_se GROUP BY query ORDER BY all_q DESC;
+-----------+-------+------------------------------------------------------+
| query     | all_q | group_concat( engine ORDER BY engine SEPARATOR ', ') |
+-----------+-------+------------------------------------------------------+
| gibberish |  1337 |                                                      |
| asdf      |    55 |                                                      |
+-----------+-------+------------------------------------------------------+
2 rows in set (0.00 sec)

But when trying to use the ORDER BY on another column, I get the right results:

mysql> SELECT query, sum(num_q) as all_q, group_concat( engine ORDER BY engine SEPARATOR ', ') FROM test_se GROUP BY query ORDER BY query DESC;
+-----------+-------+------------------------------------------------------+
| query     | all_q | group_concat( engine ORDER BY engine SEPARATOR ', ') |
+-----------+-------+------------------------------------------------------+
| gibberish |  1337 | test1                                                |
| asdf      |    55 | 2, test1                                             |
+-----------+-------+------------------------------------------------------+
2 rows in set (0.00 sec)

I tried to change the type of the num_q column, but it had no effect.
[3 Aug 2003 4:33] Alexander Keremidarski
4.1 from bk tree returns correct results for both queries.

Chance is that it is fixed after 4.1.0 with some of other GROUP_CONCAT fixes

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.049 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.