title: update where select with count mysql
body: <p>I have a table called 'people' and people has an associated table named 'appearances'. I'd like to update the people table with the 'appearance_count' selected with a left join in MySQL. I'm just having some trouble with the syntax. Where would I put my update statement in the following query. I tried an update similar to this but I kept getting an error 'cannot update same table as selected table' (or something to that effect). Here is my query in its raw select form:</p>
  
  <pre><code> SELECT        people.*, 
   COUNT(appearances.id) as app_count,
   FROM          `people`
   INNER JOIN    `appearances`
   ON            `appearances`.`person_id` = `people`.`id`
   GROUP BY      `people`.`id`
   HAVING        app_count &gt; 0;
  </code></pre>
  
  <p>How would I take "app_count" and set people.appearance_count to be that value?</p>