Skip to content
Advertisement

i have birthdate in the table , i need to find age between 30 to 70 how can I write sql query for that? [closed]

begin age and end age find where age is between 30 to 70 i just have birth date in table

Birthday
01/22/1960 12:00:00 AM
10/14/1930 12:00:00 AM
11/15/1955 12:00:00 AM
05/20/1991 12:00:00 AM
06/10/2005 12:00:00 AM

Advertisement

Answer

Use date comparisons. Something like the following, depending on whether or not you want to include the end years:

where birthday <= curdate() - interval 30 year and
      birthday > curdate() - interval 71 year
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement