Well, it might not be SQL standard, but most databases out there allow
you to use the alias in your where clauses. It helps make the sql more
readable, and it shouldn't be that hard to add this feature to the
parser, so it can translate that alias back to the original row-source
selection, during parse time.
/morten
Paul DuBois wrote:
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
FROM geographics
WHERE distance <1
ORDER BY distance
LIMIT 10;
Returns:
#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.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]