Both source and destination tables have about 40 columns. No. of rows to be updated is about 20. Row count of Destination table is around 30k.
Is there a better (shorter query) approach to below?
UPDATE destination_table t1
SET
field1 = (select field1 from src_table t2 where t2.pk = t1.pk),
field2 = (select field2 from src_table t2 where t2.pk = t1.pk),
...
field40 = (select field40 from src_table t2 where t2.pk = t1.pk),
WHERE EXISTS (select 1 from src_table t2 where t2.pk = t1.pk)
You could use something like this:
You just need to add in the extra fields to update.