title: SQL query to select all forum threads but order them by the latest active thread
body: <p>I'm currently using this code to order the forum threads within my forum according to the date they were created.</p>
  
  <pre><code>$e = mysqli_real_escape_string($_GET["forum"]);
  $q = mysqli_query($con,
       "SELECT * FROM threads WHERE forum = '$e' ORDER BY date DESC LIMIT $offset,$rowsPerPage");
  </code></pre>
  
  <p>However, this order's the threads by their creation date rather than their activity.<br>
  How can I order the threads by their activity?</p>
  
  <p>I'm thinking of something along the lines of<br>
  <code>SELECT * FROM threads WHERE forum = '$e' ORDER BY (replies in this thread).date DESC LIMIT 5</code></p>
  
  <p>Is this possible or not?</p>
  
  <p><b>EDIT:</b><br>
  <code>table thread holds the inital thread data</code><br>
  <code>table replies holds the replies</code></p>