diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result
index e8f6426f51be75d7530f09fb11127f2f5796d52c..0b813a07a1dcaf0a97b1f3e2605c09136d37a9d2 100644
--- a/mysql-test/r/subselect_innodb.result
+++ b/mysql-test/r/subselect_innodb.result
@@ -114,3 +114,29 @@ SELECT R.unit, R.ingredient FROM t1 R WHERE R.ingredient IN (SELECT N.ingredient
 unit	ingredient
 xx	yy
 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;
diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test
index 54c56e640dc83a4482d66b296edd91c2cbc1524d..aa7fe13887660eb5ef212d3a3956a2f9c721dc0d 100644
--- a/mysql-test/t/subselect_innodb.test
+++ b/mysql-test/t/subselect_innodb.test
@@ -129,8 +129,19 @@ 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;
+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 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;