mirror of
https://github.com/MariaDB/server.git
synced 2025-08-31 22:22:30 +03:00
Merge ibabaev@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into rurik.mysql.com:/home/igor/mysql-5.0-opt
This commit is contained in:
@@ -36,19 +36,19 @@ Tables_in_test
|
||||
t1
|
||||
t2
|
||||
t3
|
||||
|
||||
_
|
||||
Test delimiter : from command line
|
||||
a
|
||||
1
|
||||
|
||||
_
|
||||
Test delimiter :; from command line
|
||||
a
|
||||
1
|
||||
|
||||
_
|
||||
Test 'go' command(vertical output) G
|
||||
*************************** 1. row ***************************
|
||||
a: 1
|
||||
|
||||
_
|
||||
Test 'go' command g
|
||||
a
|
||||
1
|
||||
|
@@ -3398,8 +3398,9 @@ drop table t1,t2;
|
||||
SELECT 0.9888889889 * 1.011111411911;
|
||||
0.9888889889 * 1.011111411911
|
||||
0.9998769417899202067879
|
||||
select 1 as ' a ';
|
||||
a
|
||||
1
|
||||
prepare stmt from 'select 1 as " a "';
|
||||
Warnings:
|
||||
Warning 1466 Leading spaces are removed from name ' a '
|
||||
execute stmt;
|
||||
a
|
||||
1
|
||||
|
@@ -3239,6 +3239,50 @@ i
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
CREATE TABLE t1 (
|
||||
id bigint(20) unsigned NOT NULL auto_increment,
|
||||
name varchar(255) NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
INSERT INTO t1 VALUES
|
||||
(1, 'Balazs'), (2, 'Joe'), (3, 'Frank');
|
||||
CREATE TABLE t2 (
|
||||
id bigint(20) unsigned NOT NULL auto_increment,
|
||||
mid bigint(20) unsigned NOT NULL,
|
||||
date date NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
INSERT INTO t2 VALUES
|
||||
(1, 1, '2006-03-30'), (2, 2, '2006-04-06'), (3, 3, '2006-04-13'),
|
||||
(4, 2, '2006-04-20'), (5, 1, '2006-05-01');
|
||||
SELECT *,
|
||||
(SELECT date FROM t2 WHERE mid = t1.id
|
||||
ORDER BY date DESC LIMIT 0, 1) AS date_last,
|
||||
(SELECT date FROM t2 WHERE mid = t1.id
|
||||
ORDER BY date DESC LIMIT 3, 1) AS date_next_to_last
|
||||
FROM t1;
|
||||
id name date_last date_next_to_last
|
||||
1 Balazs 2006-05-01 NULL
|
||||
2 Joe 2006-04-20 NULL
|
||||
3 Frank 2006-04-13 NULL
|
||||
SELECT *,
|
||||
(SELECT COUNT(*) FROM t2 WHERE mid = t1.id
|
||||
ORDER BY date DESC LIMIT 1, 1) AS date_count
|
||||
FROM t1;
|
||||
id name date_count
|
||||
1 Balazs NULL
|
||||
2 Joe NULL
|
||||
3 Frank NULL
|
||||
SELECT *,
|
||||
(SELECT date FROM t2 WHERE mid = t1.id
|
||||
ORDER BY date DESC LIMIT 0, 1) AS date_last,
|
||||
(SELECT date FROM t2 WHERE mid = t1.id
|
||||
ORDER BY date DESC LIMIT 1, 1) AS date_next_to_last
|
||||
FROM t1;
|
||||
id name date_last date_next_to_last
|
||||
1 Balazs 2006-05-01 2006-03-30
|
||||
2 Joe 2006-04-20 2006-04-06
|
||||
3 Frank 2006-04-13 NULL
|
||||
DROP TABLE t1,t2;
|
||||
i1 int(11) NOT NULL default '0',
|
||||
i2 int(11) NOT NULL default '0',
|
||||
t datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
|
Reference in New Issue
Block a user