Solved

Date Computation

Posted on 2006-10-22
2
173 Views
Last Modified: 2013-11-20
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.
0
Comment
Question by:MyQ2004
  • 2
2 Comments
 
LVL 8

Assisted Solution

by:deepu chandran
deepu chandran earned 50 total points
ID: 17786669
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
 
LVL 8

Accepted Solution

by:
deepu chandran earned 50 total points
ID: 17786703
hi,
SELECT * where (DATEDIFF(day,'9/23/2006', getdate())) = 30
JUst give your Date Field in the above query

Deepu
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now