我有一个更新查询,我试图更新一个字段但是对于多个记录,我正在尝试连接,但它不起作用。下面我得到了从select语句返回的多个值,但我认为我的语法在下面是不正确的。
UPDATE sku@bn2 x
INNER JOIN (
select g.prev_perm_ret, g.itm_cd
from gm_prc_reg_prc_items g, sku@bn2 b
where g.itm_cd=b.stylecode
and b.storecode=00000
and g.prev_perm_ret<>b.listprice
and g.prev_perm_ret>g.ret_prc
and b.sellprice=b.listprice
) y ON x.stylecode=g.itm_cd
SET x.listprice=y.prev_perm_ret
答案 0 :(得分:0)
MERGE INTO sku@bn2 x
USING (
select g.prev_perm_ret, g.itm_cd
from gm_prc_reg_prc_items g, sku@bn2 b
where g.itm_cd=b.stylecode
and b.storecode=00000
and g.prev_perm_ret<>b.listprice
and g.prev_perm_ret>g.ret_prc
and b.sellprice=b.listprice
) y ON x.stylecode=Y.itm_cd
when matched then update
set x.listprice=y.prev_perm_ret