title: MySQL Server Error when using ROWCOUNT to insert only unique records
body: <p>I'm testing some javascript code in node, the mysql package in node and mysql in the visual studio code terminal. </p>
  
  <p>I've tried everything I can think of - adding (), '', "", etc...I've divided the statement into just an update statement and just an insert statement and run it against the table in phpmyadmin...and surprisingly, each statement works just fine! It's only when I add the "IF @@ROWCOUNT=0 that the whole statement breaks. </p>
  
  <p>My script is running the following SQL statement which is saved to a javascript variable:</p>
  
  <pre><code>var sql = "UPDATE players SET userID='123',username='FNNewUser',site='blah' WHERE userID='123' IF @@ROWCOUNT=0 PRINT 'NO ROWS UPDATED'";
  </code></pre>
  
  <p>When I run the script, it acts like it's going to work, but then throws the following error:</p>
  
  <pre><code>Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF @@ROWCOUNT=0 PRINT 'NO ROWS UPDATED'' at line 1
      at Query.Sequence._packetToError (C:\node\node_modules\mysql\lib\protocol\sequences\Sequence.js:47:14)
      at Query.ErrorPacket (C:\node\node_modules\mysql\lib\protocol\sequences\Query.js:77:18)
      at Protocol._parsePacket (C:\node\node_modules\mysql\lib\protocol\Protocol.js:291:23)
      at Parser._parsePacket (C:\node\node_modules\mysql\lib\protocol\Parser.js:433:10)
      at Parser.write (C:\node\node_modules\mysql\lib\protocol\Parser.js:43:10)
      at Protocol.write (C:\node\node_modules\mysql\lib\protocol\Protocol.js:38:16)
      at Socket.&lt;anonymous&gt; (C:\node\node_modules\mysql\lib\Connection.js:91:28)
      at Socket.&lt;anonymous&gt; (C:\node\node_modules\mysql\lib\Connection.js:525:10)
      at Socket.emit (events.js:189:13)
      at addChunk (_stream_readable.js:284:12)
      --------------------
      at Protocol._enqueue (C:\node\node_modules\mysql\lib\protocol\Protocol.js:144:48)
      at Connection.query (C:\node\node_modules\mysql\lib\Connection.js:201:25)
      at axios.get.then.response (C:\node\df-lineups.js:34:8)
      at process._tickCallback (internal/process/next_tick.js:68:7)
  </code></pre>
  
  <p>I'm trying to check if a record already exists in a mysql, and if the record DOESN'T exist...then running the insert statement. While this question has probably been answered on StackO, I'm also very interested as to why when I add the IF conditional to my SQL statement it throws the error.</p>