In MySQL, can I use IF in INSERT context?
<p>Like:</p>

<pre><code>INSERT INTO `video_play_counts`
   (`id`,`video_id`,`date`,`count`,`created`,`modified`) 
VALUES 
   ("",1,"2016-12-01",26,"2016-12-03 17:51:53","2016-12-03 17:51:53") 
ON DUPLICATE KEY UPDATE 
  `count` = GREATEST(`count`,VALUES(`count`)), 
  `modified` = IF(VALUES(`count`) &gt; `count`,VALUES(`modified`),`modified`)
</code></pre>

<p>So, I have a unique key on <code>video_id</code> and <code>date</code> and when I make an UPDATE on this unique key, in the case that the new <code>count</code> value is bigger the existing one, I would like to also update the <code>modified</code> field accordingly. 
The <code>count</code> field updates as expected but the <code>modified</code> field does not get the new value in the case of an UPDATE.</p>

<p>Please note that I'm using this to do multiple insert/update in one query, just in this example it has only one set of values.</p>

<p>What am I doing wrong ?</p>