UPON DUPLICATE KEY increment multiple columns?
问题 Im running a database log and every day I log on a new row. My Mysql query therefore checks if the day (date (the unique key)) already exists, and if so, it tries to increment all the loggable values of the log-row by one. If the date record doesnt eyist yet, it will create a new row. My SQL query is: INSERT INTO `log` (`date`,`hits`,`stale`) VALUES ('2012-03-06',1,1) ON DUPLICATE KEY UPDATE `hits`=`hits`+1,`stale`=`stale`+1 WHERE `date`='2012-03-06';" All columns have 0 as default value, so