Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Date Filtered

Author  Topic 

BankOfficerHere
Posting Yak Master

124 Posts

Posted - 2008-10-22 : 03:21:50
I have this where satement:

WHERE (Datereviewed>= DATEADD(DAY, DATEDIFF(DAY, '19000107', GETDATE()) / 7 * 7, '19000107') - 7) AND (Datereviewed <= DATEADD(DAY, DATEDIFF(DAY, '19000107', GETDATE()) / 7 * 7, '19000107') - 1)

My problem goes like this. It only filters up to 2008-10-18 00:00:00.000 but it doesn't includes after that. Example: 2008-10-18 17:43:55.603.

Is there a way to fix this? thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-10-22 : 03:42:55
[code]WHERE dateReviewed >= DATEADD(DAY, DATEDIFF(DAY, '19000107', GETDATE()) / 7 * 7, '18991231')
AND dateReviewed < DATEADD(DAY, DATEDIFF(DAY, '19000101', GETDATE()) / 7 * 7, '18991231')[/code]As suggested before, use an open-ended condition.


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -