Home > database >  MySQL trigger is not new to this keyword??
MySQL trigger is not new to this keyword??

Time:10-04

Want to insert data into a list to a list for the other at the same time, and then wrote the following code, but new the key word here is always has a problem,
 database client version: libmysql - mysqlnd 5.0.12 - dev - 20150407 

The trigger code below
 CREATE DEFINER=` root ` @ ` localhost ` TRIGGER ` fan_insert ` AFTER INSERT ON ` fan ` FOR EACH ROW INSERT INTO ` user_info ` (` userid `) VALUES NEW. ` userid ` ON DUPLICATE KEY UPDATE ` redundance `=` redundance ` 

I use phpmyadmin for adding triggers, where is the problem?

CodePudding user response:

 
The CREATE DEFINER=` root ` @ ` localhost ` TRIGGER ` fan_insert `
AFTER INSERT ON ` fan `
FOR EACH ROW
INSERT INTO ` user_info ` (` userid `) VALUES NEW. ` userid ` ON DUPLICATE KEY UPDATE ` redundance `=` redundance `

Code so convenient you see

CodePudding user response:

I am fan insert the data in the table at once is inserted into the article N, is not a a insert

CodePudding user response:

Mysql currently only the article bore the touch hair (a insert 10, trigger 10 times), FOR EACH ROW the meaning of the keyword is clear the
So is the VALUES (), lost you handle size
  • Related