db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From TXVanguard <brett.den...@lmco.com>
Subject Understanding an UPDATE
Date Tue, 06 Mar 2012 01:19:25 GMT

When I run the following SQL statements in JavaDB:

================================================

drop table t1;
drop table t2;

create table t1 ( TXT1 varchar(6), ID integer );

create table t2 ( ID integer, TXT2 varchar(12));

insert into t1 (TXT1,id) values ('ONE',1);
insert into t1 (TXT1,id) values ('TWO',2);

insert into t2 (id,TXT2) values (2,'TWO');
insert into t2 (id,TXT2) values (3,'THREE');

UPDATE t1 SET TXT1 = (select (TXT2) FROM t2 WHERE (t2.ID = t1.ID));

=================================================

then, table t1 has the following values:

            VAL1      ID
ROW 1: <NULL>      1
ROW 2: 'TWO'         2

Why is the value of column VAL1 in the first row set to <NULL> by the update
statement?
-- 
View this message in context: http://old.nabble.com/Understanding-an-UPDATE-tp33448196p33448196.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Mime
View raw message