如何为给定产品id和商店id的所有行运行它:
一个表:ps_product_shop
<表类>
id_product
价格
id_shop
tbody><<tr>1 1 1 125 3 22 1 250 3 表类>
像这样?
UPDATE ps_product p, ps_product_shop ps
SET p.price = p.price*25, ps.price = ps.price*25
WHERE p.id_product = 1 AND ps.id_product = 1 AND ps.id_shop = 2
我已经想到了,也许它会帮助别人:
UPDATE ps_product_shop AS sk SET
price=(SELECT price FROM ps_product_shop
WHERE id_product = sk.id_product AND id_shop = '1')*27 WHERE (sk.id_shop='3');
所有行sk.id_shop='3'