navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

How to Compare Dates in SQL Query

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> How to Compare Dates in SQL Query
Page: [1]
 
ScribeVision

 

Posts: 274
From: None
Status: offline

 
How to Compare Dates in SQL Query - 8/3/2004 16:10:44   
I created a web site for employees request that coding changes be reviewed before the code is released. The employees are supposed to request this review at least 7 days before releasing their code.

So the employee fills out a form to add their request to the database. The database (among other things) captures the date/time the request was entered and the date/time they plan to release the code. After the code is released, the employee goes back and updates the status of their request from the default 'open' to 'comp'. The date/time of the completion update is also captured.

Now they want me to create two new queries:

- Display all requests that were submitted with less than 7 days lead time before the release date

- Display all requests that were not updated to 'comp' within 24 hours of the release date

Anybody done something similar that can share how I can phrase the sql in the DRW?

Timing is critical because I will be mobilizing with my National Guard unit for duty in Iraq in the next week or so!
BeTheBall

 

Posts: 6336
Joined: 6/21/2002
From: West Point Utah USA
Status: online

 
RE: How to Compare Dates in SQL Query - 8/3/2004 16:34:18   
You will want to employ the DateDiff function.

quote:

- Display all requests that were submitted with less than 7 days lead time before the release date


SELECT * FROM Table WHERE DateDiff('d', submitdate, releasedate) < 7

quote:

- Display all requests that were not updated to 'comp' within 24 hours of the release date


SELECT * FROM Table WHERE DateDiff('h', releasedate, updatetocompdate) < 24

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to ScribeVision)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> How to Compare Dates in SQL Query
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts