"Graeme B. Davis" wrote:
> I have a select that does a formula like:
> SELECT name1, name2, someformula*pi()+atan(blah) AS test FROM blah ...
> why can't I use WHERE test < 100? It gives me a 'unknown column in where
> clause' error ...
> I hope I don't have to insert into a temp table to do this... are there any
> ways around this? could I put the formula as the WHERE clause? ie. WHERE
> someformula*pi()+atan(blah) < 100
< cut >
You can't use test in a WHERE clause, because it is unknown at the time the WHERE clauses
Your formular will be calculated, after the row has been fetched from the table.
Therefore you only can check agains 'test' with the HAVING clause, which will be used
against the results of the query.