title: Update table using a select query
body: <p>So i have read a few posts on here but i cant seem to get this working on MySQL.</p>
  <p>Pretty much I have a 'count' of records with an itemid that i want to update into my [items] table based on the itemid into [items].[popularity].</p>
  <p>This is what i have tried:</p>
  <pre><code>Update items
  SET items.popularity = countitems.countofscriptiD
  FROM items
  INNER JOIN
  (SELECT Count(scripts.ScriptID) AS CountOfScriptID, scripts.ItemID
  FROM scripts GROUP BY scripts.ItemID) as countitems
  ON
  items.itemid =  countitems.itemid
  </code></pre>
  <p>Which returns a MySQL error:</p>
  <blockquote>
  <h1>1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use</h1>
  <p>near 'FROM items INNER JOIN (SELECT Count(scripts.ScriptID) AS
  CountOfScriptID, scri' at line 3</p>
  </blockquote>
  <p>If i change this to a SELECT query it works fine, either selecting from [items] or the count query however the update statement is failing!</p>
  <p>Any advice would be great, from what i have read I can't see where I'm going wrong with this.</p>