Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

POSTGRES INSERT INTO TABLE VALUE FROM OTHER TABLE

##fetch data from other table with sub-query to insert it into another one

INSERT INTO PUBLIC."MyTable"(conversion_job_id, message, last_status)
VALUES (17, 'test', (SELECT status FROM PUBLIC."OtherTable" WHERE id=17))
RETURNING *
 
PREVIOUS NEXT
Tagged: #POSTGRES #INSERT #INTO #TABLE #VALUE #FROM #OTHER #TABLE
ADD COMMENT
Topic
Name
5+8 =