Calculate Age using Date Field
So if you have a database table that has DOB borthdays as date fields, this is an easy way to query that table based on age parameters. The following examples assume that the date of birth date field is dob and the table name is people.
Find people who are 30 years old
FROM `people` HAVING `age` = 30
Find people who are 31-42 years old
FROM `people` HAVING `age`>= 31 AND `age` <= 42
Find oldest person
FROM `people`
Find youngest person
FROM `people`
You’re currently reading “ Calculate Age using Date Field ,” an entry on BRADINO
- Published:
- 2.18.09 / 8pm
- Category:
- MySQL























Have your say