 <p>You could use a non-correlated subquery to do the work for you:</p> <pre><code>UPDATE tbl_taxclasses c INNER JOIN ( SELECT COUNT(regionsid) AS n FROM tbl_taxclasses_regions GROUP BY classid ) r USING(classid) SET c.regionscount = r.n WHERE c.classid = 1 </code></pre>