1. 2012年2月18日 张三 从账户‘77777777’中取出现金200元
2. 2012年2月19日 张三 从账户‘77777777’中转出300元到账户‘99999999’中
1. update Customer_Balance set balance = balance - 200 where card_id = '77777777'
insert into BillingHistory(card_id, amount, billing_date) values ('77777777', -200, '2012-02-18')
2. update Customer_Balance set balance = balance - 300 where card_id = '77777777'
update Customer_Balance set balance = balance + 300 where card_id = '99999999'
insert into BillingHistory(card_id, amount, billing_date) values ('77777777', -300, '2012-02-19')
insert into BillingHistory(card_id, amount, billing_date) values ('99999999', 300, '2012-02-19')
这样可以吗,加入一张表示客户余额表,一张表示存取历史表
insert into BillingHistory(card_id, amount, billing_date) values ('77777777', -200, '2012-02-18')
2. update Customer_Balance set balance = balance - 300 where card_id = '77777777'
update Customer_Balance set balance = balance + 300 where card_id = '99999999'
insert into BillingHistory(card_id, amount, billing_date) values ('77777777', -300, '2012-02-19')
insert into BillingHistory(card_id, amount, billing_date) values ('99999999', 300, '2012-02-19')
这样可以吗,加入一张表示客户余额表,一张表示存取历史表
温馨提示:答案为网友推荐,仅供参考