title: Select count of max items, get rank and percentile
body: <p>I have a table with multiple entries per <code>person_id</code> column. I'm storing a <code>score</code>, a <code>category_id</code>, and a <code>created</code> column as well. So every time the person completes the indicated category I store a single record for them.</p>
  
  <p>Now I'm trying to write a query that says:  Just using the most recently created score for each person, find out how many people scored worse than I did for a specific category.  I'm basically doing a percentile calculation here.  So to get the total number scores I'm doing:</p>
  
  <pre class="lang-sql prettyprint-override"><code>select count(distinct person_id) from performances where category_id = 7;
  </code></pre>
  
  <p>I'm not sure how to write the second query though, that finds out how many people did worse than me.  Is this somewhere I'd use that "OVER PARTITION" type windowing function?</p>