事务

START TRANSACTION;  -- 事务开始
SELECT balance FROM cheaking where cid=123;
UPDATE cheaking set balance=balance-200 where cid=123;
UPDATE asving set balance=balance+200 WHERE aid=123;
COMMIT;  -- 事务提交

编程技巧