Z
Z
zimbura2016-01-12 17:04:47
MySQL
zimbura, 2016-01-12 17:04:47

Sql query for mass replacement of values ​​by condition?

There is a table
Table (param)
column 1 (id) - product id
column 2 (flt_id) - parameter id
column 3 (value) - parameter value id
Some products have about 5700 pieces (the ids of these products are known and there is a list of these product ids )
for the parameter with id (3) you need to change the value (-1) to the value (27547)
Example for the product with id 1756
column 1 (id) 1756
column 2 (flt_id) 3
column 3 (value) -1
It is necessary that the
column become 1 (id) 1756
column 2 (flt_id) 3
column 3 (value) 27547
Replace in bulk with sql query, according to the list of product id
What would not affect other products

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Max, 2016-01-12
@MaxDukov

UPDATE bla-bla-bla SET value='27547' WHERE id IN (list of id here)

A
Alexander, 2016-01-12
@cz_350

UPDATE param
SET value= REPLACE(price, '-1', '27547');
This is not for a list, but to replace all price=-1 with price=27547

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question