List:General Discussion« Previous MessageNext Message »
From:Christian Mack Date:May 4 1999 5:59pm
Subject:Re: WHERE clause
View as plain text  
"Graeme B. Davis" wrote:
> 
> Hello,
> 
> 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
> 
> ?
> 
> thanks,
> 
> Graeme
< cut > 

Hi Graeme

You can't use test in a WHERE clause, because it is unknown at the time the WHERE clauses
are processed.
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.

Tschau
Christian

Thread
WHERE clauseGraeme B. Davis4 May
  • Re: WHERE clausePaul Wolstenholme4 May
    • Benchmark questionSuresh Rajagopalan4 May
      • Benchmark questionMichael Widenius11 May
  • Re: WHERE clauseChristian Mack4 May