Bug #5564 Strange behaviour with group_concat and distinct
Submitted: 14 Sep 2004 8:16 Modified: 10 Oct 2004 8:41
Reporter: Masamichi Akiyoshi Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.4-gamma OS:Windows (Windows XP)
Assigned to: Ramil Kalimullin CPU Architecture:Any

[14 Sep 2004 8:16] Masamichi Akiyoshi
Description:
MySQL returns strange result using group_concat with distinct as following.
select group_concat(distinct field1) from table1 group by field2;

How to repeat:
create table t1 (i int, t text);
insert into t1 values (1, "France");
insert into t1 values (1, "India");
insert into t1 values (1, "Japan");
insert into t1 values (1, "America");
insert into t1 values (1, "India");
select group_concat(distinct t) as tt from t1 group by i;

+----------------------+
| tt                   |
+----------------------+
| India,India          |
+----------------------+
1 row in set (0.02 sec)

I expected "France,India,Japan,America"
[14 Sep 2004 8:26] Alexander Keremidarski
mysql> select group_concat(t), group_concat(distinct t) as tt from t1 group by i;
+----------------------------------+----------------------+
| group_concat(t)                  | tt                   |
+----------------------------------+----------------------+
| France,India,Japan,America,India | India,Indiac,Indiaca |
+----------------------------------+----------------------+
1 row in set (0.01 sec)
[10 Oct 2004 8:41] Ramil Kalimullin
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html