There is an int type field sales in the item table. How to use SQL to update the sales volume? When the sales field is null, set it to the numerical quantity, otherwise set sales to the original sales+quantity?
迷茫2017-05-16 13:02:43
Solved
UPDATE `item` SET `item`.`sales` = IFNULL(`item`.`sales`, 0)+2 WHERE `item`.`id` = 2;