title: How do I select a row with max count doing a group by
body: <p>I have a table <code>posts</code> with columns (<code>id</code>, <code>user_name</code>, <code>thread_id</code>).<br>
  A user can submit multiple posts for a thread. thread to post is one to many.</p>
  
  <p>I need to find out who submitted max posts per thread. So the result would be
  <code>Max(Count)</code>, <code>user_name</code>, <code>thread_id</code> WHERE there will be only one row per thread_id.</p>
  
  <p>The table is too huge so I wanted to get the query optimized as much as I could.</p>