title: Getting grouped post where max time is lower than defined
body: <p>I'm working on a news feed that needs to be able to figure out posts based on comments, while that in itself is simple enough I can't figure out how to only get "posts" where the newest comment is older than a specific time.</p>
  
  <p>In order to demonstrate, here is an overly simplified version of my data:</p>
  
  <pre><code>+----+---------+------------+
  | id |  Module |    Time    |
  +----+---------+------------+
  |  1 | Forum   | 1343739050 |
  |  2 | Gallery | 1343739150 |
  |  3 | Gallery | 1343739250 |
  |  4 | Forum   | 1343739350 |
  +----+---------+------------+
  </code></pre>
  
  <p>To get the five most recently commented modules i would simply use</p>
  
  <pre><code>SELECT module, max(time) FROM `comments` GROUP BY module ORDER BY max(time) DESC LIMIT 0, 5
  </code></pre>
  
  <p>which will return</p>
  
  <pre><code>+---------+------------+
  |  Module |  max(Time) |
  +---------+------------+
  | Forum   | 1343739350 |
  | Gallery | 1343739250 |
  +---------+------------+
  </code></pre>
  
  <p>Exactly what I want.
  The problem arises when I only want to get modules where the most resent comment is older than a specific time.
  For instance older than 1343739350 (the time of the comment with id 4), but is i simply throw in a where clause it will still return Forum as it has one comment that matches it.</p>
  
  <p>I made a wild guess and tryed</p>
  
  <pre><code>SELECT module, max(time) FROM `comments` GROUP BY module WHERE max(time) &lt; 1343739350 ORDER BY max(time) DESC LIMIT 0, 5
  </code></pre>
  
  <p>That however turned out to be wishful thinking on my part.</p>
  
  <p>So question is, how do I write a mysql command that can do that?</p>