I have a database table with a date of birth column. I need a query that lists people in the 20-24 age range. At the same time, this query will be in a where clouse. I tried to use the DATEDIFF()
function but I couldn't get what I wanted.
SELECT DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(),'DATE_OF_BIRTH')), '%Y');
I find out that I can use this query but I can't put it in a where clouse. Is there an easier way?