Date Computation

My application is supposed to perform a SQL query to list down transaction not processed in the last 30 days. How shall I construct such SQL statement ? Thanks.
MyQ2004Asked:
Who is Participating?
 
deepu chandranConnect With a Mentor Commented:
hi,
SELECT * where (DATEDIFF(day,'9/23/2006', getdate())) = 30
JUst give your Date Field in the above query

Deepu
0
 
deepu chandranConnect With a Mentor Commented:
Hi,
This example query will help you For this,
DATEDIFF() Function Will Find Out The Difference Between the Dates.

USE pubs
GO
SELECT DATEDIFF(day, pubdate, getdate()) AS no_of_days
FROM titles
GO

Refer this urls also
http://msdn2.microsoft.com/en-us/library/ms174630.aspx
http://www.stanford.edu/~bsuter/sql-datecomputations.html
I think this will help you
Deepu
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.