Brogrim
asked on
MySQL After Upadte
I have written a trigger (with help from EE)
My problem is that if any part of the record is updated the trigger will execute, this is causing multiple records to be inserted into the service log.
How can I only execute the trigger only if the CostWallet changes and is >1
CREATE DEFINER=`root`@`%` TRIGGER trg_WalletIssue
AFTER UPDATE ON tblpermit
FOR EACH ROW
BEGIN
IF New.CostWallet > 1 Then
INSERT INTO tblservice_log
SET DDAI_ServicesID = '4',
id = New.id,
UserID = (SELECT b.UserID FROM tblBatch b WHERE b.BatchID = New.PermitBatchID LIMIT 1),
DDAI_Services_Date = NOW();
END IF;
END
My problem is that if any part of the record is updated the trigger will execute, this is causing multiple records to be inserted into the service log.
How can I only execute the trigger only if the CostWallet changes and is >1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER