MySQL Forums
Forum List  »  Triggers

Re: New to triggers-- help on field change
Posted by: Peter Brawley
Date: December 21, 2013 04:24PM

Something like ...

Create Trigger After Update On User For Each Row
Insert Into BalanceHistory 
Set
  User_idUser_FK=OLD.user,
  timestamp=Now(),
  change_amount=NEW.cur_balance-OLD.cur_balance,
  old_balance=OLD.cur_balance,
  new_balance=NEW.balance;

but change_amount is entirely redundant, lose it.

Options: ReplyQuote


Subject
Views
Written By
Posted
2005
December 21, 2013 03:32PM
Re: New to triggers-- help on field change
1123
December 21, 2013 04:24PM


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.