The error message is pretty explicit: you can't use an aggregate in a WHERE clause without a GROUP BY function with a HAVING clause:
SQL HAVING Clause[
^]
Me? I'd split is and select the MAX value into a variable, then use the variable in the comparison - it would also be a lot more efficient!