4
I need to search in my Mysql age of some registered collaborators. I have the field dt_nascimento and I need for example to find collaborators who are between 20 and 30 years old, how can I do this?
With this piece of code 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
Thank you Harry Potter, I did not mention the question of accuracy of months and days, but honestly helped me a lot because analyzing the result this query gives me will be very interesting to show the values in the query response.
– adventistapr
@adventistapr, no problem, you are not guilty of anything, and good that helped!
– user6026