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. 1305636 fiddles created (20293 in the last week).

CREATE TABLE table1 (id int, bla1 varchar(10), bla2 varchar(10), ucr varchar(10));
 hidden batch(es)


INSERT INTO table1 VALUES (10001, 'ABC', 33, 'VALUE1');
 hidden batch(es)


INSERT INTO table1 VALUES (10002, 'DEF', 44, 'VALUE2');
 hidden batch(es)


CREATE TABLE table2 (id int, bla1 varchar(10), bla2 varchar(10), email varchar(100));
 hidden batch(es)


INSERT INTO table2 VALUES (10001, 'TYU', 33, '1@1.com');
 hidden batch(es)


INSERT INTO table2 VALUES (10002, 'FGT', 44, '2@2.com');
 hidden batch(es)


CREATE TABLE dummy (ucr int, name varchar(100), email varchar(100));
 hidden batch(es)


INSERT INTO dummy VALUES (10001, 'ABC', '1@1.com');
 hidden batch(es)


INSERT INTO dummy VALUES (10002, 'DEF', '2@2.com');
 hidden batch(es)


UPDATE table1 JOIN table2 ON table1.id = table2.id JOIN dummy ON dummy.email = table2.email SET table1.ucr = dummy.ucr;
 hidden batch(es)


SELECT * FROM table1;
id bla1 bla2 ucr
10001 ABC 33 10001
10002 DEF 44 10002
 hidden batch(es)