clear markdown compare help donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
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. 497144 fiddles created (9372 in the last week).

CREATE TABLE t1 (id int, foo int); CREATE TABLE t2 (id int, bar int); INSERT INTO t2 VALUES (1, 2);
1 rows affected
 hidden batch(es)


WITH x AS ( SELECT * FROM t2 WHERE id = 1 ), y AS ( INSERT INTO t1 (id, foo) SELECT id, bar FROM x RETURNING * ) SELECT x.*, y.* FROM x, y
id bar id foo
1 2 1 2
 hidden batch(es)