Solved

Date Computation

Posted on 2006-10-22
2
177 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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…
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.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

728 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