M
M
msimrial2015-08-10 15:20:04
MySQL
msimrial, 2015-08-10 15:20:04

How to implement such a sql query for update?

update table_price set price IN (22, 33, 44, 55, 6, 77.33 , 33 , 55.33 ) where id_product IN (22,33,44,55,66,77,88,22)
i.e. clearly such an id such a price, and not through a mass update of each separately

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kovalsky, 2015-08-10
@msimrial

You need to make a temporary table with new value mapping. And then something like this

UPDATE table_price
set price = #temp.price
FROM table_price as price
INNER JOIN #temp on #temp.product = price.productId

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question