title: mySQL update exiting value by variable amount
body: <p>I have a column in a table called stock_quantity. Each record has a specific number indicating the amount of stock currently in inventory. I am using node inquirer to prompt the user to input an amount to add to an existing stock_quantity record. I would like to update the specific record for stock_quantity without having to make a query to the database to get the existing stock-quantity. Is the possible or do i have to do the separate query to grab the specific existing quantity and then do the math before the update query?</p>
  
  <p>If I use the following snippet I can update a record by a specific amount (e.g. 1):</p>
  
  <pre><code>connection.query("UPDATE product SET stock_quantity = stock_quantity + 1 
  WHERE ?",
      [
        {
          item_id: itemID
        }
      ],
      function(err, result) {
        if(err) {
          console.log(err);
        }
  
        console.log("Stock Quantity of item " + itemID + " increased by " + 
        addQty + " units.");
      }
    );
  </code></pre>
  
  <p>However, if I try to update the record for stock_quantity by a variable amount I get an error.  I've tried the following:</p>
  
  <pre><code>var itemID = parseInt(answer.item_id);
  var addQty = parseInt(answer.add_qty);
  
  if(typeof addQty === "number") {
  
    connection.query("UPDATE product SET stock_quantity = stock_quantity + 
    addQTY WHERE ?",
      [
        {
          item_id: itemID
        }
      ],
      function(err, result) {
        if(err) {
          console.log(err);
        }
  
        console.log(result);
  
        console.log("Stock Quantity of item " + itemID + " increased by " + 
        addQty + " units.");
      }
    );
  }  
  </code></pre>
  
  <p>I've also tried this:</p>
  
  <pre><code>var itemID = parseInt(answer.item_id);
  var addQty = parseInt(answer.add_qty);
  
  if(typeof addQty === "number") {
  
    connection.query("UPDATE product SET ? WHERE ?",
      [
        {
          stock_quantity: stock_quantity + addQty
        },      
        {
          item_id: itemID
        }
      ],
      function(err, result) {
        if(err) {
          console.log(err);
        }
  
        console.log(result);
  
        console.log("Stock Quantity of item " + itemID + " increased by " + 
        addQty + " units.");
      }
    );
  }
  </code></pre>
  
  <p>Finally, I tried this:</p>
  
  <pre><code>var itemID = parseInt(answer.item_id);
  var addQty = parseInt(answer.add_qty);
  
  if(typeof addQty === "number") {
  
    connection.query("UPDATE product SET stock_quantity = stock_quantity + ? 
    WHERE ?",
      [
        {
          addQty
        },
        {
          item_id: itemID
        }
      ],
      function(err, result) {
        if(err) {
          console.log(err);
        }
  
        console.log(result);
  
        console.log("Stock Quantity of item " + itemID + " increased by " + 
        addQty + " units.");
      }
    );
  }
  </code></pre>