Postgresql Update with subquery -


this question has answer here:

update customer c set name = b.name,  age = b.age (select a.*, b.* customer_temp a.id = b.id) b 

i got sql above, after run query, update rows same result.

i wonder need after

update customer c set name = b.name,  age = b.age (select a.*, b.* customer_temp a.id = b.id) d c.id = d.id 

but got id ambiguous last query.

try this

update customer set     name = b.name,      age = b.age customer c     inner join customer_temp b on b.id = c.id 

sql fiddle example


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -