title: Count number of times, a number appears and update it to a different column
body: <p>I am not sure how to do this in mysql, i have searched but I can't seem to find a solution.
  , 
  I have a table like so.</p>
  
  <pre><code>id pid occurrence  
  1  23  blank
  2  23  blank
  3  44  blank
  </code></pre>
  
  <p>Basically, occurrence should have the value of 2, for id 1,2 and a value of 1 for id 3. 
  Any help would be appreciated. I can easily call count and GROUP BY, and get the number of times each one occurance, but I would like to update column occurrence in the right place for each pid.</p>