这个就可以 但是用a表用别名就不可以了
update bicon_st_qty_lst set price=b.price from bicon_ware_in_dtl b where bicon_st_qty_lst.goods_batchid=b.batchid and bicon_st_qty_lst.goodsid=b.goodsid;
错误示范:
update bicon_st_qty_lst a set a.price=b.price from bicon_ware_in_dtl b where a.goods_batchid=b.batchid and a.goodsid=b.goodsid;
update bicon_retail_orderdtl set cost_price=b.price
from (select DISTINCT on (goodsid) goodsid,price,count(goodsid) from bicon_ware_in_dtl where bicon_state='1' and goodsid is not null and price is not null GROUP BY goodsid,price order by goodsid) as b where bicon_retail_orderdtl.goodsid=b.goodsid
postgresql通过a表更新b表
最新推荐文章于 2024-02-21 11:07:01 发布