PostgreSQL
 sql >> Database >  >> RDS >> PostgreSQL

Aggiornamento Postgresql con join

Sintassi di aggiornamento generale:

[ WITH [ RECURSIVE ] with_query [, ...] ]
UPDATE [ ONLY ] table [ [ AS ] alias ]
    SET { column = { expression | DEFAULT } |
          ( column [, ...] ) = ( { expression | DEFAULT } [, ...] ) } [, ...]
    [ FROM from_list ]
    [ WHERE condition | WHERE CURRENT OF cursor_name ]
    [ RETURNING * | output_expression [ [ AS ] output_name ] [, ...] ]

Soluzione per il tuo problema:

UPDATE customers AS c
SET cutoffstop = cutoffstop + 432000
FROM bluemedia as b
WHERE c.id = b.customerid
AND b.orderid = '217201807'

Per ulteriori informazioni su UPDATE sintassi segui il link sottostante:

https://www.postgresql.org/docs/current/static/sql-update.html