DELIMITER $$ USE `db`$$ DROP TRIGGER `member_walletinit_trigger`$$ CREATE TRIGGER `member_walletinit_trigger` AFTER INSERT ON `member` FOR EACH ROW BEGIN SET @count = (SELECT COUNT(mem_no) FROM `wallet` WHERE mem_no = NEW.reg_no); IF @count = 0 THEN INSERT INTO wallet (mem_no)VALUE(NEW.reg_no); END IF; END; $$ DELIMITER ;
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/4646.html