title: Selecting most recent MySQL rows by MAX(time) WHERE time <= x
body: <p>I am selecting the most recent entries of a MySQL table with:</p>
  
  <pre><code>SELECT MAX(time) as most_recent, userID
  FROM TableName
  GROUP BY userID
  ORDER BY most_recent DESC
  </code></pre>
  
  <p>My problem is, if I want to limit the maximum time with:</p>
  
  <pre><code>WHERE time &lt;= nnn
  </code></pre>
  
  <p>The query does not work anymore. Is there a solution for with without a subquery?</p>
  
  <p>Thanks in advance!</p>