summaryrefslogtreecommitdiff
path: root/mysql-test/t/subselect_innodb.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/subselect_innodb.test')
-rw-r--r--mysql-test/t/subselect_innodb.test20
1 files changed, 20 insertions, 0 deletions
diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test
index 5f4badb3624..aa7fe138876 100644
--- a/mysql-test/t/subselect_innodb.test
+++ b/mysql-test/t/subselect_innodb.test
@@ -125,3 +125,23 @@ INSERT INTO `t2` VALUES ('yy','xx');
SELECT R.unit, R.ingredient FROM t1 R WHERE R.ingredient IN (SELECT N.ingredient FROM t2 N WHERE N.unit = R.unit);
drop table t1, t2;
+
+#
+# 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;
+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 * from t1;
+drop table t1;