Correct syntax/format for MySQL Trigger with Date Criteria -


I am trying to prepare a trigger that checks the test if a 'request' is made before a specific date And if it sets 'yes' to the flag, and 'no'.

But PHPMyAdmin just tells me that there is an error, the full trigger is already activated and working, so I did not include it in the rest. This is just the snippet that needs to be improved. Is:

I think if there is a problem with the formatting of IF statement / date criteria:

  IF NEW.RequestDate & lt; '2012-07-12 00:00:00' then set new FlagRPRU Towel Twenty Toub = "Yes"; ELSE SET NEW.flagReqPreJulyTwelfthTwentyTwelve = "no"; end if;  

I think you can not change NEW.flagReqPreJulyTwelfthTwentyTwelve. Why do not you use local variables and enter that value in your table like this:

  if new '2012-07-12 00:00:00' then set myvar = "YES"; Either set = "no"; end if;  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -