Mysql update case UPDATE table SET total = CASE WHEN total = '1' THEN total- 1 ELSE total = '2' END WHERE id = 17