clear markdown feedback
clear markdown feedback
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 3364508 fiddles created (36247 in the last week).

CREATE TABLE A (col1 varchar(10), col2 varchar(10), col3 varchar(10));
 hidden batch(es)


CREATE TABLE B (col1 varchar(10), col2 varchar(10), col3 varchar(10));
 hidden batch(es)


INSERT INTO A (col3) VALUES ('1');
 hidden batch(es)


INSERT INTO B (col3) VALUES ('1'), ('2'), ('3');
 hidden batch(es)


SELECT * FROM A;
col1 col2 col3
1
 hidden batch(es)


SELECT * FROM B;
col1 col2 col3
1
2
3
 hidden batch(es)


UPDATE A, B INNER JOIN ( SELECT 'a' AS col1, 'x' AS col2, '1' AS col3 UNION ALL SELECT 'b', 'y', '2' UNION ALL SELECT 'c', 'z', '3' ) AS fltr ON B.col3 = fltr.col3 SET A.col1 = 'abc', A.col2 = 'xyz', B.col1 = fltr.col1, B.col2 = fltr.col2 WHERE A.col3 = '1' ;
 hidden batch(es)


SELECT * FROM A;
col1 col2 col3
abc xyz 1
 hidden batch(es)


SELECT * FROM B;
col1 col2 col3
a x 1
b y 2
c z 3
 hidden batch(es)