title: MySQL - What Does It Mean To Have An AND Before WHERE In A Set Query?
body: <p>Recently, I discovered that a query I had modified about a year ago was silently failing (doing nothing at all).</p>
  
  <p>I traced the problem to a syntax error. Instead of using a comma to set multiple fields I'd put AND by mistake. So instead of setting a second field as intended, it was setting no fields at all.</p>
  
  <p>My original query was like this:</p>
  
  <pre><code>UPDATE `report` SET `confirm` = 2 WHERE `id` = 999
  </code></pre>
  
  <p>Modifying it like this is apparently perfectly valid syntax:</p>
  
  <pre><code>UPDATE `report` SET `confirm` = 2 AND `time_confirm` = UNIX_TIMESTAMP() WHERE `id` = 999
  </code></pre>
  
  <p>I know that I should use a comma (and did even then), and I should have tested even a small simple change like this (beyond the standard error handling), and I've now paid very dearly for that mistake. However, I'm still quite curious to understand why the query is valid and what it's actually doing.</p>
  
  <p>According to the <a href="https://dev.mysql.com/doc/refman/8.0/en/update.html" rel="nofollow noreferrer">MySQL documentation</a>, it expects a comma separated list of assignments at that location.</p>
  
  <p>What does the query I put actually do and why is it allowed in the MySQL syntax without throwing any sort of error?</p>