MySQL update from nested SELECT query
<p>I have 2 tables which are getting different values from different sources.
One table called <code>stock</code> has 2 fields, code and stock, while other have code, stock (and bunch more not relevant to what I want to do)
Basically my current query for checking if there are enough quantities is following</p>

<pre><code>SELECT * 
FROM products
WHERE products.code 
NOT IN (SELECT stock.code from stock) 
AND products.stock &gt; 0 
AND products.product_active = 1
</code></pre>

<p>Which works, but I would like to extend it to UPDATE <code>stock</code> field of the table <code>products</code> to value 0 for the results of the above query. </p>

<p>Thanks</p>