beam
beam copied to clipboard
Insert result of an insert
Is it possible to make a query like this in beam?
with ins as ( insert into table1 (email) values('[email protected]') returning userid ) insert into table2 (userid, name, address) select userid, 'joe', '123 test Dr' from ins
this seams like a natural thing to do, if the value you need to insert is split in multiple tables, and all inserts should fail if one of them fails, without another insert being possible in between.
The query above is taken from: https://stackoverflow.com/questions/63821001/insert-result-from-one-insert-query-into-another-insert
(And is this the right place to ask a question like this, or would you prefer it another place?)