title: How do i get top n records of each category
body: <p>I am here to get records based on categories.</p>
  
  <p>My table <strong>foo</strong> has fields <strong>[id, name, class]</strong>. my records can be like: </p>
  
  <pre><code>1, ram, 10
  2, hari, 9
  3, sita, 10
  4, gita, 9
  5, rita, 5
  6, tina, 7
  8, nita, 8
  9, bita, 5
  10,seta, 7
  </code></pre>
  
  <p>...and more...</p>
  
  <p>Now i would like to get result with each record from different class.. i.e something like</p>
  
  <pre><code>1, ram, 10
  2, hari, 9
  5, rita, 5
  6, tina, 7
  8, nita, 8
  </code></pre>
  
  <p>i.e just top <strong>1</strong> records as per class</p>