postgresql连表更新

时间:2020-04-16 15:27:59   收藏:0   阅读:83
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;

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!