Hello,
   I am working with h2 database and my select statement is very
simple but not working as per expected.
Before starting this discussion, I have gone through all previous post
with select statement problem .But I can't find out similar behaviour
I am experiencing.
Please see below simple commands.

drop table if exists test1;
create table test1( ID BIGINT Primary Key, T1 BIGINT );
insert into test1(ID, T1) VALUES (1,1), (2,2), (3,3);

drop table if exists test2;
create table test2( ID BIGINT Primary Key, PARENT_ID BIGINT, T2
BIGINT);
insert into test2(ID, PARENT_ID, T2) VALUES (1,1,1),  (2,1,2),
(3,1,3),
(4,2,1), (5,2,3),(6,2,2);

select * from test1;
select * from test2;

SELECT T1 FROM test2;

Select * FROM test1 WHERE ID=(SELECT T1 FROM test2 where ID=3);
Above select statement should fail with sql error as T1 is not a
column in
test2
But it doesn't
It actually returns 3 rows

Select * FROM test1 WHERE ID=(SELECT T3 FROM test2 where ID=3);
But for this select statement it is throwing sql error. That is
correct.
Thanks in advance

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to