I need to search my MySQL for some registered employees. I have the dt_nation field and I need, for example, to look for employees who are between 20 and 30 years old, how can I do that?
With this code snippet I get the dates, but unfortunately it's not what I need, see:
SELECT (YEAR(CURDATE())-YEAR(dt_nascimento)) - (RIGHT(CURDATE(),5)<RIGHT(dt_nascimento,5)) as idade FROM candidato c