1 2 3 4 5 6 7 8 9 10 11 12 13 14
| create table tab1 (a number, b number, c number default null);
insert into tab1(a,b) values (1, 10);
insert into tab1(a,b) values (2, 20);
insert into tab1(a,b) values (3, 30);
insert into tab1(a,b) values (4, 40);
create table tab2 (d number, e number, f number);
insert into tab2 values (1, 11,101);
insert into tab2 values (2, 22,202);
insert into tab2 values (3, 33,303);
insert into tab2 values (4, 44,404);
update tab1 set c=(select (d+e+f)/3. from tab2,tab1 where tab2.d=tab1.a and tab2.d=4)
where tab1.a=(select d from tab2,tab1 where tab2.d=tab1.a and tab1.a=4); |
Partager