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
2045
December 21, 2013 03:32PM
Re: New to triggers-- help on field change
1142
December 21, 2013 04:24PM


Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.

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.