I am trying to make searches based on the age of a person. The db contains
only the Date of Birth.
So...
My first attempt was to try the following :
(this is all done in the command line on Win2000)
SELECT firstname, surname, dob, floor((to_days(curdate())-to_days(DO😎)/365)
AS age FROM artistes;
This works and returns all the values with the addition of an age column
with what appears to be the correct age.
However...
When I try adding a WHERE clause:
SELECT firstname, surname, dob, floor((to_days(curdate())-to_days(DO😎)/365)
AS age FROM artistes WHERE age = "25";
I get ERROR 1054: Unknown column 'age' in 'where clause'
How am I to use this 'virtual' age column in my searches?
I want to be able to search on exact and age ranges plus display the age in
the returned results.
Any ideas/feedback truly welcome, I am 'under the cosh' to get this done
asap!!! (as usual)
TIA
matt