daily pastebin goal
92%
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE TRIGGER updateDailyPayment
  2. AFTER INSERT ON payment
  3. FOR EACH ROW
  4. BEGIN
  5.     IF DATE(NEW.payment_date) NOT IN (SELECT payment_date
  6.                             FROM dailypayment)
  7.     THEN
  8.         INSERT INTO dailypayment
  9.         VALUES (DATE(NEW.payment_date), NEW.amount);
  10.     ELSE
  11.         UPDATE dailypayment
  12.         SET totalamount = totalamount + NEW.amount
  13.         WHERE dailypayment.payment_date = DATE(NEW.payment_date);
  14.     END IF;
  15. END
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top