I'm trying to write a query that will return all records w/a datetime of either today, tomorrow, or yesterday. i have this query:
WHERE
ap.ApptStart <= DATEADD(day,+1,GetDate()) AND
ap.ApptStart >= DATEADD(day,-1,GetDate())
it seems like it should work... but it doesn't return any records from yesterday. i tried messing with adding a time of 00:00:00 but that still didn't seem to work. anyone have any thoughts?upon further inspection it appears to be looking b/w yesterday at the current time and tomorrow at the current time. how do i return just the date and not the time so it will do anything yesterday today and tomorrow?hmmm this seems to be working:
WHERE datediff(d,Getdate(),ap.ApptStart) <= 1 AND
datediff(d,Getdate(),ap.ApptStart) >= -1glad to be of help....
WHERE
ap.ApptStart <= DATEADD(day,+1,GetDate()) AND
ap.ApptStart >= DATEADD(day,-1,GetDate())
it seems like it should work... but it doesn't return any records from yesterday. i tried messing with adding a time of 00:00:00 but that still didn't seem to work. anyone have any thoughts?upon further inspection it appears to be looking b/w yesterday at the current time and tomorrow at the current time. how do i return just the date and not the time so it will do anything yesterday today and tomorrow?hmmm this seems to be working:
WHERE datediff(d,Getdate(),ap.ApptStart) <= 1 AND
datediff(d,Getdate(),ap.ApptStart) >= -1glad to be of help....