@@ -367,8 +367,8 @@ bb,ccc,a,bb,ccc
367
367
BB,CCC,A,BB,CCC
368
368
select group_concat(distinct b) from t1 group by a;
369
369
group_concat(distinct b)
370
- bb,ccc,a
371
- BB,CCC,A
370
+ a, bb,ccc
371
+ A, BB,CCC
372
372
select group_concat(b order by b) from t1 group by a;
373
373
group_concat(b order by b)
374
374
a,bb,bb,ccc,ccc
@@ -387,11 +387,11 @@ Warning 1260 Row 2 was cut by GROUP_CONCAT()
387
387
Warning 1260 Row 4 was cut by GROUP_CONCAT()
388
388
select group_concat(distinct b) from t1 group by a;
389
389
group_concat(distinct b)
390
- bb,c
391
- BB,C
390
+ a,bb
391
+ A,BB
392
392
Warnings:
393
- Warning 1260 Row 2 was cut by GROUP_CONCAT()
394
- Warning 1260 Row 4 was cut by GROUP_CONCAT()
393
+ Warning 1260 Row 3 was cut by GROUP_CONCAT()
394
+ Warning 1260 Row 6 was cut by GROUP_CONCAT()
395
395
select group_concat(b order by b) from t1 group by a;
396
396
group_concat(b order by b)
397
397
a,bb
@@ -417,8 +417,8 @@ bb,ccc,a,bb,ccc,1111111111111111111111111111111111111111111111111111111111111111
417
417
BB,CCC,A,BB,CCC,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
418
418
select group_concat(distinct b) from t1 group by a;
419
419
group_concat(distinct b)
420
- bb,ccc ,a,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
421
- BB,CCC ,A,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
420
+ 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112 ,a,bb,ccc
421
+ 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112 ,A,BB,CCC
422
422
select group_concat(b order by b) from t1 group by a;
423
423
group_concat(b order by b)
424
424
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,a,bb,bb,ccc,ccc
@@ -437,11 +437,11 @@ Warning 1260 Row 7 was cut by GROUP_CONCAT()
437
437
Warning 1260 Row 14 was cut by GROUP_CONCAT()
438
438
select group_concat(distinct b) from t1 group by a;
439
439
group_concat(distinct b)
440
- bb,ccc,a,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
441
- BB,CCC,A,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
440
+ 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
441
+ 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
442
442
Warnings:
443
- Warning 1260 Row 5 was cut by GROUP_CONCAT()
444
- Warning 1260 Row 10 was cut by GROUP_CONCAT()
443
+ Warning 1260 Row 2 was cut by GROUP_CONCAT()
444
+ Warning 1260 Row 4 was cut by GROUP_CONCAT()
445
445
select group_concat(b order by b) from t1 group by a;
446
446
group_concat(b order by b)
447
447
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
@@ -526,9 +526,9 @@ a group_concat(b)
526
526
NULL 3,4,2,1,2,7,3,3
527
527
select a, group_concat(distinct b) from t1 group by a with rollup;
528
528
a group_concat(distinct b)
529
- 1 3,4,2,1
530
- 2 7,3
531
- NULL 3,4,2,1 ,7
529
+ 1 1,2,3,4
530
+ 2 3,7
531
+ NULL 1,2,3,4 ,7
532
532
select a, group_concat(b order by b) from t1 group by a with rollup;
533
533
a group_concat(b order by b)
534
534
1 1,2,2,3,4
@@ -751,10 +751,10 @@ CREATE TABLE t1(a TEXT, b CHAR(20));
751
751
INSERT INTO t1 VALUES ("one.1","one.1"),("two.2","two.2"),("one.3","one.3");
752
752
SELECT GROUP_CONCAT(DISTINCT UCASE(a)) FROM t1;
753
753
GROUP_CONCAT(DISTINCT UCASE(a))
754
- ONE.1,TWO.2, ONE.3
754
+ ONE.1,ONE.3,TWO.2
755
755
SELECT GROUP_CONCAT(DISTINCT UCASE(b)) FROM t1;
756
756
GROUP_CONCAT(DISTINCT UCASE(b))
757
- ONE.1,TWO.2, ONE.3
757
+ ONE.1,ONE.3,TWO.2
758
758
DROP TABLE t1;
759
759
CREATE TABLE t1( a VARCHAR( 10 ), b INT );
760
760
INSERT INTO t1 VALUES ( repeat( 'a', 10 ), 1),
@@ -853,7 +853,7 @@ create table t1(a bit(2) not null);
853
853
insert into t1 values (1), (0), (0), (3), (1);
854
854
select group_concat(distinct a) from t1;
855
855
group_concat(distinct a)
856
- 1,0 ,3
856
+ 0,1 ,3
857
857
select group_concat(distinct a order by a) from t1;
858
858
group_concat(distinct a order by a)
859
859
0,1,3
@@ -866,13 +866,13 @@ insert into t1 values (1, 'a', 0), (0, 'b', 1), (0, 'c', 0), (3, 'd', 1),
866
866
(1, 'e', 1), (3, 'f', 1), (0, 'g', 1);
867
867
select group_concat(distinct a, c) from t1;
868
868
group_concat(distinct a, c)
869
- 10 ,01,00,31,11
869
+ 00 ,01,10,11,31
870
870
select group_concat(distinct a, c order by a) from t1;
871
871
group_concat(distinct a, c order by a)
872
872
00,01,11,10,31
873
873
select group_concat(distinct a, c) from t1;
874
874
group_concat(distinct a, c)
875
- 10 ,01,00,31,11
875
+ 00 ,01,10,11,31
876
876
select group_concat(distinct a, c order by a, c) from t1;
877
877
group_concat(distinct a, c order by a, c)
878
878
00,01,10,11,31
@@ -1176,3 +1176,29 @@ Warning 1260 Row 5 was cut by GROUP_CONCAT()
1176
1176
DROP TABLE t1;
1177
1177
SET group_concat_max_len= DEFAULT;
1178
1178
End of 5.6 tests
1179
+ #
1180
+ # Bug #25331425: DISTINCT CLAUSE DOES NOT WORK IN GROUP_CONCAT
1181
+ #
1182
+ CREATE TABLE t1 (a VARCHAR(1000), b INT);
1183
+ INSERT INTO t1 VALUES ('a', 1), ('b', 2), ('a', 3), ('b', 5), ('c', 5);
1184
+ SELECT GROUP_CONCAT(DISTINCT a) FROM t1;
1185
+ GROUP_CONCAT(DISTINCT a)
1186
+ a,b,c
1187
+ SELECT GROUP_CONCAT(DISTINCT a), b FROM t1 GROUP BY b;
1188
+ GROUP_CONCAT(DISTINCT a) b
1189
+ a 1
1190
+ b 2
1191
+ a 3
1192
+ b,c 5
1193
+ SET @@tmp_table_size=1024;
1194
+ SELECT GROUP_CONCAT(DISTINCT a) FROM t1;
1195
+ GROUP_CONCAT(DISTINCT a)
1196
+ a,b,c
1197
+ SELECT GROUP_CONCAT(DISTINCT a), b FROM t1 GROUP BY b;
1198
+ GROUP_CONCAT(DISTINCT a) b
1199
+ a 1
1200
+ b 2
1201
+ a 3
1202
+ b,c 5
1203
+ SET @@tmp_table_size=default;
1204
+ DROP TABLE t1;
0 commit comments