Hi Guys,
I'm trying to build a query that will search our user database for users that are within a certain age range.
User's birthday is kept as a smalldatetime
The form will ask for two ages.. a min and max..
For instance 18-45
I am using CFML, and it has a function called datediff that I used to deduct the actual datetime for each age and create a datetime variable...
However, when I try and work the select statement and choose records that fall within the range, I am not getting any matches.
For instance, one member has the birthday of (the time stamp is what is in the DB
birthday - {ts '1980-06-19 00:00:00'}
I've tried both variations of SQL statements below. The query runs, but it doesn't return any matches, even though there should be plenty.
Select *
Where birthday between {ts '1961-08-24 12:43:18'} AND {ts '1995-08-24 12:43:18'}
AND
Where birthday >= {ts '1961-08-24 13:57:16'} AND birthday <= {ts '1995-08-24 13:57:16'}
What am I doing wrong?
I'm trying to build a query that will search our user database for users that are within a certain age range.
User's birthday is kept as a smalldatetime
The form will ask for two ages.. a min and max..
For instance 18-45
I am using CFML, and it has a function called datediff that I used to deduct the actual datetime for each age and create a datetime variable...
However, when I try and work the select statement and choose records that fall within the range, I am not getting any matches.
For instance, one member has the birthday of (the time stamp is what is in the DB
birthday - {ts '1980-06-19 00:00:00'}
I've tried both variations of SQL statements below. The query runs, but it doesn't return any matches, even though there should be plenty.
Select *
Where birthday between {ts '1961-08-24 12:43:18'} AND {ts '1995-08-24 12:43:18'}
AND
Where birthday >= {ts '1961-08-24 13:57:16'} AND birthday <= {ts '1995-08-24 13:57:16'}
What am I doing wrong?