MySQL Forums
Forum List  »  Triggers

New to triggers-- help on field change
Posted by: Ryan Walsh
Date: December 21, 2013 03:32PM


I am new to Triggers and could use your help.

I have a table called User with fields called idUser, cur_balance.

I have another table called BalanceHistory.

Anytime there is an update to User.cur_balance I would like a row inserted into BalanceHistory with the following fields:

idBalanceHistory(set to autoincrement), User_idUser_FK(The User id from User table), timestamp(set to current_timestamp), change_amount (the amount the balance has changed), old_balance(the balance before the update), new_balance (the balance after the update)

Any help would be greatly appreciated.


Options: ReplyQuote

Written By
New to triggers-- help on field change
December 21, 2013 03:32PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.