0

Possible Duplicate:
How to calculate age (in years) based on Date of Birth and getDate()

Does anyone know how i can set a where clause to say get only those users aged 26-33, by calculating age from date of birth?

I have previously used this to get all users aged below 25 and now i'm just wondering if i could use it to get those aged 26 - 33 or if theres a better way?

AND DOB >= ADDDATE(CURRENT_DATE(), INTERVAL -25 YEAR)
Community
  • 1
  • 1

1 Answers1

1
AND DOB BETWEEN ADDDATE(CURRENT_DATE(), INTERVAL -33 YEAR) AND ADDDATE(CURRENT_DATE(), INTERVAL -26 YEAR) 

(As a suggestion - not tested)

Sebas
  • 21,192
  • 9
  • 55
  • 109