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

Postgresql-opdatering med join

Generel opdateringssyntaks:

[ 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 ] [, ...] ]

Løsning til dit problem:

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

For mere information om UPDATE syntaks følg nedenstående link:

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



  1. FLOSS UK forårskonference

  2. En oversigt over indeksændringerne i PostgreSQL 11

  3. Opdater data via en funktion med tabelværdi i SQL Server

  4. Sådan forbinder du ekstern MySQL-database i PHP