@@ -363,8 +363,8 @@ bb,ccc,a,bb,ccc
363363BB,CCC,A,BB,CCC
364364select group_concat(distinct b) from t1 group by a;
365365group_concat(distinct b)
366- bb,ccc,a
367- BB,CCC,A
366+ a, bb,ccc
367+ A, BB,CCC
368368select group_concat(b order by b) from t1 group by a;
369369group_concat(b order by b)
370370a,bb,bb,ccc,ccc
@@ -383,11 +383,11 @@ Warning 1260 Row 2 was cut by GROUP_CONCAT()
383383Warning 1260 Row 4 was cut by GROUP_CONCAT()
384384select group_concat(distinct b) from t1 group by a;
385385group_concat(distinct b)
386- bb,c
387- BB,C
386+ a,bb
387+ A,BB
388388Warnings:
389- Warning 1260 Row 2 was cut by GROUP_CONCAT()
390- Warning 1260 Row 4 was cut by GROUP_CONCAT()
389+ Warning 1260 Row 3 was cut by GROUP_CONCAT()
390+ Warning 1260 Row 6 was cut by GROUP_CONCAT()
391391select group_concat(b order by b) from t1 group by a;
392392group_concat(b order by b)
393393a,bb
@@ -413,8 +413,8 @@ bb,ccc,a,bb,ccc,1111111111111111111111111111111111111111111111111111111111111111
413413BB,CCC,A,BB,CCC,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
414414select group_concat(distinct b) from t1 group by a;
415415group_concat(distinct b)
416- bb,ccc ,a,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
417- BB,CCC ,A,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
416+ 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112 ,a,bb,ccc
417+ 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112 ,A,BB,CCC
418418select group_concat(b order by b) from t1 group by a;
419419group_concat(b order by b)
4204200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,a,bb,bb,ccc,ccc
@@ -433,11 +433,11 @@ Warning 1260 Row 7 was cut by GROUP_CONCAT()
433433Warning 1260 Row 14 was cut by GROUP_CONCAT()
434434select group_concat(distinct b) from t1 group by a;
435435group_concat(distinct b)
436- bb,ccc,a,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
437- BB,CCC,A,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
436+ 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
437+ 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
438438Warnings:
439- Warning 1260 Row 5 was cut by GROUP_CONCAT()
440- Warning 1260 Row 10 was cut by GROUP_CONCAT()
439+ Warning 1260 Row 2 was cut by GROUP_CONCAT()
440+ Warning 1260 Row 4 was cut by GROUP_CONCAT()
441441select group_concat(b order by b) from t1 group by a;
442442group_concat(b order by b)
4434430000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
@@ -520,9 +520,9 @@ a group_concat(b)
520520NULL 3,4,2,1,2,7,3,3
521521select a, group_concat(distinct b) from t1 group by a with rollup;
522522a group_concat(distinct b)
523- 13,4,2,1
524- 27,3
525- NULL3,4,2,1 ,7
523+ 11,2,3,4
524+ 23,7
525+ NULL1,2,3,4 ,7
526526select a, group_concat(b order by b) from t1 group by a with rollup;
527527a group_concat(b order by b)
5285281 1,2,2,3,4
@@ -745,10 +745,10 @@ CREATE TABLE t1(a TEXT, b CHAR(20));
745745INSERT INTO t1 VALUES ("one.1","one.1"),("two.2","two.2"),("one.3","one.3");
746746SELECT GROUP_CONCAT(DISTINCT UCASE(a)) FROM t1;
747747GROUP_CONCAT(DISTINCT UCASE(a))
748- ONE.1,TWO.2, ONE.3
748+ ONE.1,ONE.3,TWO.2
749749SELECT GROUP_CONCAT(DISTINCT UCASE(b)) FROM t1;
750750GROUP_CONCAT(DISTINCT UCASE(b))
751- ONE.1,TWO.2, ONE.3
751+ ONE.1,ONE.3,TWO.2
752752DROP TABLE t1;
753753CREATE TABLE t1( a VARCHAR( 10 ), b INT );
754754INSERT INTO t1 VALUES ( repeat( 'a', 10 ), 1),
@@ -847,7 +847,7 @@ create table t1(a bit(2) not null);
847847insert into t1 values (1), (0), (0), (3), (1);
848848select group_concat(distinct a) from t1;
849849group_concat(distinct a)
850- 1,0 ,3
850+ 0,1 ,3
851851select group_concat(distinct a order by a) from t1;
852852group_concat(distinct a order by a)
8538530,1,3
@@ -860,13 +860,13 @@ insert into t1 values (1, 'a', 0), (0, 'b', 1), (0, 'c', 0), (3, 'd', 1),
860860(1, 'e', 1), (3, 'f', 1), (0, 'g', 1);
861861select group_concat(distinct a, c) from t1;
862862group_concat(distinct a, c)
863- 10 ,01,00,31,11
863+ 00 ,01,10,11,31
864864select group_concat(distinct a, c order by a) from t1;
865865group_concat(distinct a, c order by a)
86686600,01,11,10,31
867867select group_concat(distinct a, c) from t1;
868868group_concat(distinct a, c)
869- 10 ,01,00,31,11
869+ 00 ,01,10,11,31
870870select group_concat(distinct a, c order by a, c) from t1;
871871group_concat(distinct a, c order by a, c)
87287200,01,10,11,31
@@ -1333,8 +1333,8 @@ select grp,group_concat(c limit 5.5...' at line 1
13331333select grp,group_concat(distinct c limit 1,10 ) from t1 group by grp;
13341334grp group_concat(distinct c limit 1,10 )
133513351 c
1336- 2b
1337- 3C,D
1336+ 2c
1337+ 3D,E
13381338select grp,group_concat(c order by a) from t1 group by grp;
13391339grp group_concat(c order by a)
134013401 b,c
@@ -1370,6 +1370,15 @@ grp group_concat(c order by c desc limit 2)
137013701 c,b
137113712 c,b
137213723 E,E
1373+ #
1374+ # Empty results for group concat as offset is greater than the rows
1375+ # for a group
1376+ #
1377+ select grp,group_concat(distinct c limit 10,1 ) from t1 group by grp;
1378+ grp group_concat(distinct c limit 10,1 )
1379+ 1
1380+ 2
1381+ 3
13731382drop table t1;
13741383create table t2 (a int, b varchar(10));
13751384insert into t2 values(1,'a'),(1,'b'),(NULL,'c'),(2,'x'),(2,'y');
0 commit comments