INSERT INTO cash_flows (`start_balance`,`end_balance`, `transaction_amount`, `transaction_type`,`customer_register_id`,`note`)
SELECT promo_balance, 0.00 , promo_balance, 'promo_expired', id,'promotion is expired'
FROM `customer_registers`
WHERE `promo_expire_date` < CURDATE();
UPDATE `customer_registers`
SET `promo_balance`= 0.00
WHERE `promo_expire_date` < CURDATE();
Asked
Active
Viewed 40 times
0

marc_s
- 732,580
- 175
- 1,330
- 1,459

Sim Chomroeun
- 15
- 4
-
What error do you get? – P.Salmon Dec 06 '17 at 07:54
-
MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE customer_registers SET promo_balance= 0.00 WHERE promo_expire_date < CURD' at line 4 – Sim Chomroeun Dec 06 '17 at 07:58
-
https://stackoverflow.com/questions/2846516/how-to-write-a-stored-procedure-using-phpmyadmin-and-how-to-use-it-through-php – Aleksandar Varicak Dec 10 '17 at 12:31