Solved

Date Computation

Posted on 2006-10-22
2
174 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Turn a spreadsheet into a vba executable. 2 85
method notes when mouse over in eclipse 5 86
pre4 challenge 19 99
Path of Workbook 3 74
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 …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

813 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