postgresql连表更新

update table_p as p 
set p_name = a.name,p_user = a.user_id,p_type = 'P02'
from (
select x.user_id,x.name,x.p_id from table_u x
join table_p y on x.p_id = y.p_id
) as a where p.p_id = a.p_id;

 

posted @ 2020-04-16 14:08  zhangqi0828  阅读(1896)  评论(0编辑  收藏  举报