【发布时间】:2016-07-27 13:33:47
【问题描述】:
我有 3 个表,我想用来自table2 的信息(列status)更新table1(列status)。 table1 和 table2 之间的链接在表中 table_con
http://www.sqlfiddle.com/#!15/6ce460/4
我想到了一个join 并使用join 的结果来更新table1
select t1.status as t1status,t2.status as t2status,t1.p_id as t1pid, t2.x_id as t2xid
from table1 t1
JOIN table_con tc
ON t1.p_id = tc.p_id
JOIN table2 t2
ON t2.x_id = tc.x_id;
join 到目前为止有效,但我不知道如何继续,
并且查询应该在 psql 中工作。谢谢
【问题讨论】:
-
您要更新哪些列?
标签: sql postgresql join sql-update