HAVING a great time

In SQL, aggregate functions can't be used in WHERE clauses. For example, the following query is invalid: