RETURNING id
を追加するだけです INSERT ... SELECT
に :
WITH rows AS (...)
INSERT INTO dealer (user_id)
SELECT id
FROM rows
RETURNING id;
デモ:http://sqlfiddle.com/#!12/75008/1
RETURNING id
を追加するだけです INSERT ... SELECT
に :
WITH rows AS (...)
INSERT INTO dealer (user_id)
SELECT id
FROM rows
RETURNING id;
デモ:http://sqlfiddle.com/#!12/75008/1