update query with join on two tables

前端 未结 5 1519
情歌与酒
情歌与酒 2020-12-18 18:13

I have customer and address tables.

Query:

SELECT *
FROM addresses a,
     customers b
WHERE a.id = b.id

5条回答
  •  忘掉有多难
    2020-12-18 19:06

    this is Postgres UPDATE JOIN format:

    UPDATE address 
    SET cid = customers.id
    FROM customers 
    WHERE customers.id = address.id
    

    Here's the other variations: http://mssql-to-postgresql.blogspot.com/2007/12/updates-in-postgresql-ms-sql-mysql.html

提交回复
热议问题