I am trying to update the records of one table using others but getting failed with the error. Can someone pls help how to fix the below query for updating records :
ERROR: multiple updates to a row by the same query is not allowed
UPDATE
table1 t1
set t1.field1=t2.field1
FROM
table1 t1
INNER JOIN table2 t2
ON upper(t1.schemaname)=upper(t2.databasename)
and upper(t1.tablename)=upper(t2.tablename)
and t1.field1!=t2.field1
WHERE
t1.field1!='test'
and T2.field1 in('abc','def')
2
Answers
Try this
Use this query, works pretty well,