select * from avg_prices
select goods_Id,goods_name,goods_sel_price,goods_buy_price from goods
select g.goods_Id,g.goods_name,g.goods_type,g.goods_sel_price,g.goods_buy_price ,a.junjia from goods g,avg_prices a where g.goods_Id = a.goods_id and g.goods_sel_price != a.junjia
问题 怎么样 将第一张表里junjia字段根据id 条件批量更新到第二张表goods表内goods_buy_price字段值。
解决方案
36
update a.junjia from goods g,avg_prices a set g.goods_sel_price = a.junji
where g.goods_Id = a.goods_id
where g.goods_Id = a.goods_id