Solved

Date Computation

Posted on 2006-10-22
2
172 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
Comment Utility
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
Comment Utility
hi,
SELECT * where (DATEDIFF(day,'9/23/2006', getdate())) = 30
JUst give your Date Field in the above query

Deepu
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.

763 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

11 Experts available now in Live!

Get 1:1 Help Now