salix/db/changes/10110-postCampaign/00-creditInsuranceAfterInse...

14 lines
382 B
SQL

DELIMITER $$
DROP TRIGGER IF EXISTS `vn`.`creditInsurance_AFTER_INSERT` $$
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`creditInsurance_afterInsert` AFTER INSERT ON `creditInsurance` FOR EACH ROW
BEGIN
UPDATE `client` c
JOIN vn.creditClassification cc ON cc.client = c.id
SET creditInsurance = NEW.credit WHERE cc.id = NEW.creditClassification;
END$$
DELIMITER ;