clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 2335540 fiddles created (27399 in the last week).

CREATE TABLE test01(t01_01 varchar(20), t01_02 float);
 hidden batch(es)


insert into test01 values ('1111',0);
 hidden batch(es)


insert into test01 values ('2222',1000);
 hidden batch(es)


CREATE TABLE test02(t02_01 varchar(20), t02_02 float);
 hidden batch(es)


insert into test02 values ('AAAA',0);
 hidden batch(es)


insert into test02 values ('BBBB',0);
 hidden batch(es)


insert into test02 values ('CCCC',5000);
 hidden batch(es)


insert into test02 values ('DDDD',8000);
 hidden batch(es)


CREATE TABLE test03(t03_01 varchar(20),t03_02 varchar(20), t03_03 float,t03_04 varchar(20));
 hidden batch(es)


insert into test03 values ('1111','AAAA',400,'');
 hidden batch(es)


insert into test03 values ('1111','BBBB',500,'');
 hidden batch(es)


insert into test03 values ('2222','AAAA',1200,'');
 hidden batch(es)


insert into test03 values ('2222','BBBB',1300,'');
 hidden batch(es)


select * from test01;
t01_01 t01_02
1111 0
2222 1000
 hidden batch(es)


select * from test02;
t02_01 t02_02
AAAA 0
BBBB 0
CCCC 5000
DDDD 8000
 hidden batch(es)


select * from test03;
t03_01 t03_02 t03_03 t03_04
1111 AAAA 400
1111 BBBB 500
2222 AAAA 1200
2222 BBBB 1300
 hidden batch(es)


UPDATE test01, test02, test03, (select t03_01,sum(t03_03) as t03_03X from test03 where 1=1 AND t03_04 <> 'Void' group by t03_01 ) AS AA , (select t03_01,t03_02,sum(t03_03) as t03_03Y from test03 where 1=1 AND t03_04 <> 'Void' group by t03_01,t03_02 ) AS BB SET t01_02 = t01_02 + t03_03X, t02_02 = t02_02 + t03_03Y, t03_04 = 'Void' WHERE 1=1 AND test03.t03_01='1111' AND test03.t03_01=test01.t01_01 AND test03.t03_02=test02.t02_01 AND test03.t03_01=AA.t03_01 AND test03.t03_02=BB.t03_02 AND test03.t03_01=BB.t03_01
 hidden batch(es)


select * from test01;
t01_01 t01_02
1111 900
2222 1000
 hidden batch(es)


select * from test02;
t02_01 t02_02
AAAA 400
BBBB 500
CCCC 5000
DDDD 8000
 hidden batch(es)


select * from test03;
t03_01 t03_02 t03_03 t03_04
1111 AAAA 400 Void
1111 BBBB 500 Void
2222 AAAA 1200
2222 BBBB 1300
 hidden batch(es)