mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/usr/local/home/marty/MySQL/mysql-4.1
This commit is contained in:
@ -392,3 +392,16 @@ SELECT SQL_CALC_FOUND_ROWS a, SUM(b) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1;
|
||||
a SUM(b)
|
||||
1 4
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a int(11) NOT NULL);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
SELECT a, SUM(a) m FROM t1 GROUP BY a WITH ROLLUP;
|
||||
a m
|
||||
1 1
|
||||
2 2
|
||||
NULL 3
|
||||
SELECT * FROM ( SELECT a, SUM(a) m FROM t1 GROUP BY a WITH ROLLUP ) t2;
|
||||
a m
|
||||
1 1
|
||||
2 2
|
||||
NULL 3
|
||||
DROP TABLE t1;
|
||||
|
@ -432,3 +432,50 @@ t1 CREATE TABLE "t1" (
|
||||
)
|
||||
set sql_mode='';
|
||||
drop table t1;
|
||||
create table t1 (a int auto_increment primary key, b int, c timestamp);
|
||||
insert into t1 (a, b, c) values (1, 0, '2001-01-01 01:01:01'),
|
||||
(2, 0, '2002-02-02 02:02:02'), (3, 0, '2003-03-03 03:03:03');
|
||||
select * from t1;
|
||||
a b c
|
||||
1 0 2001-01-01 01:01:01
|
||||
2 0 2002-02-02 02:02:02
|
||||
3 0 2003-03-03 03:03:03
|
||||
update t1 set b = 2, c = c where a = 2;
|
||||
select * from t1;
|
||||
a b c
|
||||
1 0 2001-01-01 01:01:01
|
||||
2 2 2002-02-02 02:02:02
|
||||
3 0 2003-03-03 03:03:03
|
||||
insert into t1 (a) values (4);
|
||||
select * from t1;
|
||||
a b c
|
||||
1 0 2001-01-01 01:01:01
|
||||
2 2 2002-02-02 02:02:02
|
||||
3 0 2003-03-03 03:03:03
|
||||
4 NULL 2001-09-09 04:46:59
|
||||
update t1 set c = '2004-04-04 04:04:04' where a = 4;
|
||||
select * from t1;
|
||||
a b c
|
||||
1 0 2001-01-01 01:01:01
|
||||
2 2 2002-02-02 02:02:02
|
||||
3 0 2003-03-03 03:03:03
|
||||
4 NULL 2004-04-04 04:04:04
|
||||
insert into t1 (a) values (3), (5) on duplicate key update b = 3, c = c;
|
||||
select * from t1;
|
||||
a b c
|
||||
1 0 2001-01-01 01:01:01
|
||||
2 2 2002-02-02 02:02:02
|
||||
3 3 2003-03-03 03:03:03
|
||||
4 NULL 2004-04-04 04:04:04
|
||||
5 NULL 2001-09-09 04:46:59
|
||||
insert into t1 (a, c) values (4, '2004-04-04 00:00:00'),
|
||||
(6, '2006-06-06 06:06:06') on duplicate key update b = 4;
|
||||
select * from t1;
|
||||
a b c
|
||||
1 0 2001-01-01 01:01:01
|
||||
2 2 2002-02-02 02:02:02
|
||||
3 3 2003-03-03 03:03:03
|
||||
4 4 2001-09-09 04:46:59
|
||||
5 NULL 2001-09-09 04:46:59
|
||||
6 NULL 2006-06-06 06:06:06
|
||||
drop table t1;
|
||||
|
Reference in New Issue
Block a user