Commit 56080a8d authored by unknown's avatar unknown

postreview fixes


mysql-test/r/subselect_innodb.result:
  fixed result of test
mysql-test/t/subselect_innodb.test:
  fixed test layout
parent b2f7b5bd
...@@ -114,3 +114,29 @@ SELECT R.unit, R.ingredient FROM t1 R WHERE R.ingredient IN (SELECT N.ingredient ...@@ -114,3 +114,29 @@ SELECT R.unit, R.ingredient FROM t1 R WHERE R.ingredient IN (SELECT N.ingredient
unit ingredient unit ingredient
xx yy xx yy
drop table t1, t2; drop table t1, t2;
CREATE TABLE t1 (
id INT NOT NULL auto_increment,
date1 DATE, coworkerid INT,
description VARCHAR(255),
sum_used DOUBLE,
sum_remaining DOUBLE,
comments VARCHAR(255),
PRIMARY KEY(id)
) engine=innodb;
insert into t1 values (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1998-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1998-01-01', 1,'test', 22, 33, 'comment'), (NULL, '2004-01-01', 1,'test', 22, 33, 'comment'), (NULL, '2004-01-01', 1,'test', 22, 33, 'comment');
SELECT DISTINCT
(SELECT sum(sum_used) FROM t1 WHERE sum_used > 0 AND year(date1) <= '2004') as somallontvangsten,
(SELECT sum(sum_used) FROM t1 WHERE sum_used < 0 AND year(date1) <= '2004') as somalluitgaven
FROM t1;
somallontvangsten somalluitgaven
154 NULL
select * from t1;
id date1 coworkerid description sum_used sum_remaining comments
1 1999-01-01 1 test 22 33 comment
2 1999-01-01 1 test 22 33 comment
3 1999-01-01 1 test 22 33 comment
4 1998-01-01 1 test 22 33 comment
5 1998-01-01 1 test 22 33 comment
6 2004-01-01 1 test 22 33 comment
7 2004-01-01 1 test 22 33 comment
drop table t1;
...@@ -129,8 +129,19 @@ drop table t1, t2; ...@@ -129,8 +129,19 @@ drop table t1, t2;
# #
# possible early unlock # possible early unlock
# #
CREATE TABLE t1 ( id INT NOT NULL auto_increment, date1 DATE, coworkerid INT, description VARCHAR(255), sum_used DOUBLE, sum_remaining DOUBLE, comments VARCHAR(255), PRIMARY KEY(id)) engine=innodb; CREATE TABLE t1 (
id INT NOT NULL auto_increment,
date1 DATE, coworkerid INT,
description VARCHAR(255),
sum_used DOUBLE,
sum_remaining DOUBLE,
comments VARCHAR(255),
PRIMARY KEY(id)
) engine=innodb;
insert into t1 values (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1998-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1998-01-01', 1,'test', 22, 33, 'comment'), (NULL, '2004-01-01', 1,'test', 22, 33, 'comment'), (NULL, '2004-01-01', 1,'test', 22, 33, 'comment'); insert into t1 values (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1998-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1998-01-01', 1,'test', 22, 33, 'comment'), (NULL, '2004-01-01', 1,'test', 22, 33, 'comment'), (NULL, '2004-01-01', 1,'test', 22, 33, 'comment');
SELECT DISTINCT (SELECT sum(sum_used) FROM t1 WHERE sum_used > 0 AND year(date1) <= '2004') as somallontvangsten, (SELECT sum(sum_used) FROM t1 WHERE sum_used < 0 AND year(date1) <= '2004') as somalluitgaven FROM t1; SELECT DISTINCT
(SELECT sum(sum_used) FROM t1 WHERE sum_used > 0 AND year(date1) <= '2004') as somallontvangsten,
(SELECT sum(sum_used) FROM t1 WHERE sum_used < 0 AND year(date1) <= '2004') as somalluitgaven
FROM t1;
select * from t1; select * from t1;
drop table t1; drop table t1;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment