I have a MySQL database. I use a SELECT AS to measure “distance” between 2 points. What I want to do is use the same “distance” variable I created in the SELECT as a WHERE condition.
SELECT first_name.last_name AS name WHERE name="John Doe"
What is the best way to accomplish this?
You may want to consider putting your condition in a HAVING clause rather than in the WHERE clause.
See http://dev.mysql.com/doc/refman/5.5/en/select.html for details on the HAVING clause.