That query is not aggregated
But you can't use a newly created column in the WHERE clause, just because it didn't exists when WHERE clause is executes.
So, one option is to use derived table (as RiverGuy show you).
Other is to double the exact same expression in WHERE.
Opps!
I didn't saw that you use RAND(). So your ONLY option is to use RiverGuy solution
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.