Aleks
asked on
Age between to dates
I am trying to get results where a user is of a certain age between two given dates (DOB) is the dob in the database.
I am not getting any results tho, here is my query:
SELECT * FROM dbo.Users
where 30
BETWEEN DATEDIFF(YEAR, DobD, 01/01/2000)AND DATEDIFF(YEAR, DobD, 01/01/2050)
The above example is for someone being 30 yrs old between 01/01/2000 and 01/01/2050 and his birthdate on DobD
Help is appreciated
I am not getting any results tho, here is my query:
SELECT * FROM dbo.Users
where 30
BETWEEN DATEDIFF(YEAR, DobD, 01/01/2000)AND DATEDIFF(YEAR, DobD, 01/01/2050)
The above example is for someone being 30 yrs old between 01/01/2000 and 01/01/2050 and his birthdate on DobD
Help is appreciated
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.