 <p>You cannot use aggregate functions after <code>WHERE</code> clause because it makes no sense, whereas <code>DATEDIFF</code> is usable. It makes no sense because it would be like telling the computer:</p> <blockquote> <p>select all the rows for which the maximum of the id column is 34</p> </blockquote> <p>which may sound somewhat logical but is not really, and is in fact the same as <code>id &lt; 35</code>. that second way is also way clearer. </p> <p>The real problem is in fact that counting the max of a column in a selection requires that a selection already be made. Hence <code>MAX</code> can't be used as a condition to actually select rows to be evaluated.</p> <p>as for <code>DATEDIFF</code>, it works because the resulting question, for the computer, is logical:</p> <blockquote> <p>select all the rows for which the difference between date1 and date2 is less then 10</p> </blockquote>