title: Order by latestThread
body: <p>I'm trying to do a complicated SQL, where I write all categories, how many threads are in the category on the page. Now i'm also trying to make it, so my Repeater, shows the latest thread in the category, based on Thread Datetime.</p>
  
  <p>This is my SQL:</p>
  
  <pre><code>SELECT categories.category_name, categories.category_id, 
  COUNT(threads.thread_category_id) 
  AS 'threadCount' FROM threads 
  RIGHT OUTER JOIN categories 
  ON categories.category_id = threads.thread_category_id
  GROUP BY categories.category_name, categories.category_id
  </code></pre>
  
  <p>I've been trying different ways, and also asked my teacher. We can't seem to find a way to make this possible, into one SQL Query, to run in a Repeater.</p>
  
  <p>Basiclly: Repeater that contains every Category with a </p>
  
  <p>Category name,<br>
  Category ID,<br>
  Count of threads in Category,<br>
  Latest Thread title,<br>
  Latest Thread datetime.</p>
  
  <p>Thread title DB field: <code>threads.thread_title</code></p>
  
  <p>Thread datetime DB field:<code>threads.thread_datetime</code></p>
  
  <p>Would appreciate any idea or help on this!</p>