【PostgreSQL】多表关联数据怎么update

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/csdnhff/article/details/52695443

更新移动库存表(warehouse_inventoryrecords)的code_

移动库存表关联出库明细表(warehouse_outbounditems

code_ 来自出库表(warehouse_outbounds





update warehouse_inventoryrecords  as wi

set code_ = a.code_
 from (select woi.id_, wo.code_ from  warehouse_outbounditems as woi 
inner join  warehouse_outbounds as wo on woi.outboundid_ = wo.id_) as a
where wi.type_ = 'OUT' and wi.inandoutanddeliveryid_ = a.id_ 
展开阅读全文

没有更多推荐了,返回首页