title: PHP/MYSQL: Get last record of table in a Join AND row count of the joined table
body: <p>Okay so I have two tables, a category table and a posts table. </p>
  
  <p>I was hoping to construct a query that would return each category, the last record in the post table for that category (category.id = post.category_id) AND the rowcount of all posts with post.category_id = category.id)</p>
  
  <p>i.e</p>
  
  <p>A list of categories, each with the record of the latest post for the category and the number of posts in that category.</p>
  
  <p>I've tried various joins and subselects, and I have managed to get a list of categories, their post count, and their FIRST post (I need the last).</p>
  
  <p>I have also managed to get  a list of categories and their LAST post, but not the post count.</p>
  
  <p>Any help/directions will be much appreciated!</p>