syntax - How to do an update + join in PostgreSQL? -


basically, want this:

update vehicles_vehicle v      join shipments_shipment s on v.shipment_id=s.id  set v.price=s.price_per_vehicle; 

i'm pretty sure work in mysql (my background), doesn't seem work in postgres. error is:

error:  syntax error @ or near "join" line 1: update vehicles_vehicle v join shipments_shipment s on v.shi...                                   ^ 

surely there's easy way this, can't find proper syntax. so, how write in postgresql?

the update syntax is:

 [ [ recursive ] with_query [, ...] ] update [ ] table [ [ ] alias ]     set { column = { expression | default } |           ( column [, ...] ) = ( { expression | default } [, ...] ) } [, ...]     [ from_list ]     [ condition | current of cursor_name ]     [ returning * | output_expression [ [ ] output_name ] [, ...] ] 

in case think want this:

update vehicles_vehicle v  set price = s.price_per_vehicle shipments_shipment s v.shipment_id = s.id  

Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -