Guest User

Untitled

a guest
Nov 24th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. | id | opening_balance | closing_balance | user_id |
  2. |----|-----------------|-----------------|---------|
  3. | 1 | 23.40 | 28.20 | 6 |
  4. | 2 | 14.70 | 11.10 | 79 |
  5. | 3 | 117.12 | 107.12 | 20 |
  6.  
  7. CREATE TRIGGER balance_update
  8. AFTER INSERT ON balance_history
  9. FOR EACH ROW
  10. BEGIN
  11. UPDATE users
  12. SET balance = NEW.closing_balance
  13. WHERE id = NEW.user_id;
  14. END;
Add Comment
Please, Sign In to add comment