In a MySQL SELECT query, can I use my "AS column" in a WHERE specification?
Posted
by
user556352
on Stack Overflow
See other posts from Stack Overflow
or by user556352
Published on 2010-12-28T19:51:11Z
Indexed on
2010/12/28
19:54 UTC
Read the original article
Hit count: 117
mysql
In my database I calculate distance between nodes with:
SELECT DISTINCT dest.name, AsText(orig.location), AsText(dest.location), round((glength(linestringfromwkb(linestring((orig.location), (dest.location)))))) as distance FROM nodes orig, nodes dest WHERE orig.name='GERP'
I would like to add "and distance < dest.visibility" at the end, but am told that distance is an unknown column.
Any insight very much appreciated.
© Stack Overflow or respective owner