In a MySQL SELECT query, can I use my "AS column" in a WHERE specification?
- by user556352
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.