Suppose I want to update two columns in one ON DUPLICATE STATEMENT:
INSERT INTO `daily_lead_rollups` (`year`, `month`, `day`, `a_id`, `f_id`, `0_d`,`0_r`) VALUES (NEW.year,NEW.month,NEW.day,NEW.a_id,NEW.f_id, 1,NEW.payout) ON DUPLICATE KEY UPDATE 0_d = 0_d + 1, 0_r =0_r + NEW.payout;
Error:
1235 – This version of MySQL doesn’t yet support ‘multiple triggers with the same action time and event for one table’
I know you can insert multiple rows, but I didn’t find anything about updating multiple columns with a calculation.
MySQL is fine with one calculation, even without
VALUES
, but has an issue with two!
I corrected the statement for future reference, the issue is resolved.
I’m not quite sure why you are trying to
VALUESlike that, but I suspect you mean this:There are also some good examples of how to use ON DUPLICATE KEY UPDATE in the manual.