Du behöver bara lägga till ett RETURNING id
till din INSERT ... SELECT
:
WITH rows AS (...)
INSERT INTO dealer (user_id)
SELECT id
FROM rows
RETURNING id;
Demo:http://sqlfiddle.com/#!12/75008/1
Du behöver bara lägga till ett RETURNING id
till din INSERT ... SELECT
:
WITH rows AS (...)
INSERT INTO dealer (user_id)
SELECT id
FROM rows
RETURNING id;
Demo:http://sqlfiddle.com/#!12/75008/1