标签: mysql sql
我想使用它以前的值修改表格列中的值。目前我使用以下两个命令:
SET @bal = (SELECT balance FROM customers WHERE id = @id) - @amount; UPDATE customers SET balance = @bal WHERE id = @id;
我能用一句话来做吗?
答案 0 :(得分:0)
UPDATE customers SET balance = balance - @amount WHERE id = @id;