At 11:32 -0700 10/11/04, Nathan Clark wrote:
>SELECT city, state, SQRT( POWER( (
>latitude - 39.039200
>), 2 ) + POWER( (
>longitude + 95.689508
>), 2 ) ) AS distance
>WHERE distance <1
>ORDER BY distance
>#1054 - Unknown column 'distance' in 'where clause'
>Are alias not allowed in WHERE clauses?
How could they be? The WHERE clause determines which rows to select.
Aliases are defined for columns from the rows that have been selected.
>I am able to replace the alias with the entire math function, and it
>works as desired. However, I do not like the heaviness/repetiveness
>of the query.
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com