How do I run it for all rows of a given product id and shop id:
One table: ps_product_shop
id_product | price | id_shop |
---|---|---|
1 | 1 | 1 |
1 | 25 | 3 |
2 | 2 | 1 |
2 | 50 | 3 |
THX
For one line: UPDATE ps_product_shop SET price=(SELECT price FROM ps_product_shop WHERE id_product = ‘1’ AND id_shop = ‘1’)*25 WHERE (id_product=’1′) AND (id_shop=’3′);
I tried but it doesn’t work: UPDATE ps_product_shop SET price=(SELECT price FROM ps_product_shop WHERE id_product = ps_product_shop.id_product AND id_shop = ‘1’)*25 WHERE ps_product_shop.id_product IN (SELECT price FROM ps_product_shop WHERE id_product = ps_product_shop.id_product AND id_shop = ‘3’);
2
Answers
I already figured it out, maybe it will help someone:
for all lines sk.id_shop='3'
Something like this?