MySQL Forums
Forum List  »  Triggers

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

Hello,

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.

Thanks,
Ryan

Options: ReplyQuote


Subject
Views
Written By
Posted
New to triggers-- help on field change
1677
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.