I have a query from the users table. Among its fields I have a field called "fechadenacimiento", through a subquery I get the age and I show it in the results. Note that this value does not exist in the table I get it on the fly, however I need to be able to save it (or set it up) to be able to make type filters:
where edad > 18 || edad < 22
This is my query.
select u.id, u.nombre, u.rfc as cu, u.nombre as estado, u.categoria, u.fnacimiento, YEAR(CURDATE())-YEAR(d.fnacimiento) as edad
from usuarios as u
I need to do something like this:
select u.id, u.nombre, u.rfc as cu, u.nombre as estado, u.categoria, u.fnacimiento, YEAR(CURDATE())-YEAR(d.fnacimiento) as edad
from usuarios as u where edad > 18 && <30
Is this possible?
Thank you.