mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge with 4.1
BitKeeper/etc/logging_ok: auto-union client/sql_string.cc: Auto merged configure.in: Auto merged include/my_global.h: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/r/create.result: Auto merged mysql-test/r/olap.result: Auto merged mysql-test/r/warnings.result: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/warnings.test: Auto merged mysys/raid.cc: Auto merged scripts/make_binary_distribution.sh: Auto merged sql/field.cc: Auto merged BitKeeper/deleted/.del-ha_isam.cc~4dce65904db2675e: Auto merged BitKeeper/deleted/.del-ha_isammrg.cc~dc682e4755d77a2e: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_blackhole.cc: Auto merged sql/ha_heap.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/ha_myisam.cc: Auto merged sql/ha_myisammrg.cc: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/handler.cc: Auto merged sql/item.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_geofunc.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/item_subselect.cc: Auto merged sql/item_sum.cc: Auto merged sql/item_timefunc.cc: Auto merged sql/item_uniq.cc: Auto merged sql/lock.cc: Auto merged sql/log_event.cc: Auto merged sql/mysql_priv.h: Auto merged sql/opt_range.h: Auto merged sql/procedure.cc: Auto merged sql/protocol.cc: Auto merged sql/protocol_cursor.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_analyse.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_error.cc: Auto merged sql/sql_handler.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_map.cc: Auto merged sql/sql_olap.cc: Auto merged sql/sql_repl.cc: Auto merged sql/sql_string.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_udf.cc: Auto merged sql/examples/ha_archive.cc: Auto merged sql/examples/ha_example.cc: Auto merged sql/examples/ha_tina.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/tztime.cc: Auto merged strings/ctype-win1250ch.c: Auto merged mysql-test/r/func_gconcat.result: merge & ensure that 4.1 and 5.0 source have tests in same order mysql-test/r/innodb.result: merge & ensure that 4.1 and 5.0 source have tests in same order mysql-test/t/func_gconcat.test: merge & ensure that 4.1 and 5.0 source have tests in same order mysql-test/t/innodb.test: merge & ensure that 4.1 and 5.0 source have tests in same order sql/item_func.cc: merge sql/mysqld.cc: merge sql/opt_range.cc: merge sql/sql_parse.cc: merge Give better name to goto labels sql/sql_select.cc: merge
This commit is contained in:
@ -343,18 +343,6 @@ GROUP_CONCAT(b ORDER BY b)
|
||||
First Row
|
||||
Second Row
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a),
|
||||
CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
|
||||
SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;
|
||||
a_id b_list
|
||||
1 1,2,3
|
||||
2 4,5
|
||||
3 NULL
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (A_ID INT NOT NULL,A_DESC CHAR(3) NOT NULL,PRIMARY KEY (A_ID));
|
||||
INSERT INTO t1 VALUES (1,'ABC'), (2,'EFG'), (3,'HIJ');
|
||||
CREATE TABLE t2 (A_ID INT NOT NULL,B_DESC CHAR(3) NOT NULL,PRIMARY KEY (A_ID,B_DESC));
|
||||
@ -462,6 +450,49 @@ SELECT GROUP_CONCAT(id) AS gc FROM t1 HAVING gc IS NULL;
|
||||
gc
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
create table t2 (a int, b int);
|
||||
insert into t2 values (1,1), (2,2);
|
||||
select b x, (select group_concat(x) from t2) from t2;
|
||||
x (select group_concat(x) from t2)
|
||||
1 1,1
|
||||
2 2,2
|
||||
drop table t2;
|
||||
create table t1 (d int not null auto_increment,primary key(d), a int, b int, c int);
|
||||
insert into t1(a,b) values (1,3), (1,4), (1,2), (2,7), (1,1), (1,2), (2,3), (2,3);
|
||||
select d,a,b from t1 order by a;
|
||||
d a b
|
||||
1 1 3
|
||||
2 1 4
|
||||
3 1 2
|
||||
5 1 1
|
||||
6 1 2
|
||||
4 2 7
|
||||
7 2 3
|
||||
8 2 3
|
||||
explain select a, group_concat(b) from t1 group by a with rollup;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using filesort
|
||||
select a, group_concat(b) from t1 group by a with rollup;
|
||||
a group_concat(b)
|
||||
1 3,4,2,1,2
|
||||
2 7,3,3
|
||||
NULL 3,4,2,1,2,7,3,3
|
||||
select a, group_concat(distinct b) from t1 group by a with rollup;
|
||||
a group_concat(distinct b)
|
||||
1 3,4,2,1
|
||||
2 7,3
|
||||
NULL 3,4,2,1,7
|
||||
select a, group_concat(b order by b) from t1 group by a with rollup;
|
||||
a group_concat(b order by b)
|
||||
1 1,2,2,3,4
|
||||
2 3,3,7
|
||||
NULL 1,2,2,3,3,3,4,7
|
||||
select a, group_concat(distinct b order by b) from t1 group by a with rollup;
|
||||
a group_concat(distinct b order by b)
|
||||
1 1,2,3,4
|
||||
2 3,7
|
||||
NULL 1,2,3,4,7
|
||||
drop table t1;
|
||||
create table t1 (a char(3), b char(20), primary key (a, b));
|
||||
insert into t1 values ('ABW', 'Dutch'), ('ABW', 'English');
|
||||
select group_concat(a) from t1 group by b;
|
||||
@ -469,10 +500,3 @@ group_concat(a)
|
||||
ABW
|
||||
ABW
|
||||
drop table t1;
|
||||
create table r2 (a int, b int);
|
||||
insert into r2 values (1,1), (2,2);
|
||||
select b x, (select group_concat(x) from r2) from r2;
|
||||
x (select group_concat(x) from r2)
|
||||
1 1,1
|
||||
2 2,2
|
||||
drop table r2;
|
||||
|
Reference in New Issue
Block a user