title: MySQL insert values if condition is met
body: <p>I am trying to insert into a table only if the qty has changed down in another table see example</p>
  
  <pre><code>INSERT INTO sales_items (sale_id, item_id, quantity_purchased, item_cost_price, item_unit_price) 
  VALUES ('1', '1546', '3', '10', '10')
  WHEN (SELECT quantity FROM  location_items WHERE  location_id =4 AND  item_id =1546) &lt; 10;
  </code></pre>