문제

I have a VB.net 2010 program, using MS personal SQL server (MSDE) version 2010, where a select statement is failing. The query works correctly from the query tester, and the program functions properly by using other queries.

The 'requestdate' entries are MM/DD/YYYY, or 1/22/2014 for a recent entry.

The SQL statement is:

Select count(*)  from Table 
WHERE (Closed = 'false') AND (requestdate < convert(date, GETDATE() - 3));

I am trying to get a count of entries that are between today and 2 days ago. There there is a simular query asking for 7 days.

Any help would be great. -Thanks

도움이 되었습니까?

해결책 2

This is what fixed it:

Select count(*) from tablew WHERE (Closed = 'false') AND (datediff(dd,requestdate,getdate()) < 3)

다른 팁

try this:

Select count(*)  from Table 
WHERE (Closed = 'false') AND (requestdate < convert(date, GETDATE()-3));
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top