J
JEM
I am trying to select children from a table whose birthday falls within
21 and 28 days from today but am not having much success. Below is the
sql statement. Does anyone know what i'm doing wrong? Thanks.
SELECT dbo.tblChild.FName, dbo.tblChild.LName,
dbo.tblChild.Birthday
FROM dbo.tblChild
WHERE (CAST(DATEPART(month, dbo.tblChild.Birthday) + DATEPART(day,
dbo.tblChild.Birthday) + DATEPART(year, GETDATE()) AS datetime) BETWEEN
DATEADD(d, 21, GETDATE()) AND DATEADD(d, 28,
GETDATE()))
21 and 28 days from today but am not having much success. Below is the
sql statement. Does anyone know what i'm doing wrong? Thanks.
SELECT dbo.tblChild.FName, dbo.tblChild.LName,
dbo.tblChild.Birthday
FROM dbo.tblChild
WHERE (CAST(DATEPART(month, dbo.tblChild.Birthday) + DATEPART(day,
dbo.tblChild.Birthday) + DATEPART(year, GETDATE()) AS datetime) BETWEEN
DATEADD(d, 21, GETDATE()) AND DATEADD(d, 28,
GETDATE()))