Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

copy from one table to another postgres using matching column

UPDATE Table2 --format schema.table_name
SET 
ref_id2 = table1.ref_id1
FROM table1 -- mention schema name
WHERE table1.id = table2.id
AND 
table1.a_ref1 = table2.b_ref1;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #copy #table #postgres #matching #column
ADD COMMENT
Topic
Name
4+8 =