Mysql查询从其当前值的2列更新

时间:2012-07-10 15:49:18

标签: mysql

MySQL版本5.1.63-cll 使用phpmyadmin编辑

所以我有这张表ps_layered_price_index 我想编辑/更新专栏: -

price_min AND
price_max 
(updating the current value+10)

where column(id_product) = ALL

1 个答案:

答案 0 :(得分:1)

如果您想更新表格的每一行,那么您可以尝试这样的事情:

UPDATE 
 ps_layered_price_index
SET 
 price_min = price_min + 10,
 price_max = price_max + 10

对于单行:

UPDATE 
 ps_layered_price_index
SET 
 price_min = price_min + 10,
 price_max = price_max + 10
WHERE 
 id_product = 87