Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date differences in SQL

Status
Not open for further replies.

Gavuk

Programmer
Apr 16, 2003
32
GB
Hiya all (again!!)

I have a main table with an ordered date and a actual delivery date. Im trying to query the database for all the equipment that has been ordered and not yet been delivered oras been 7 days from ordering and not been deliverd. Does anyone know the SQl for this kind of request:

Im guessing something like.

Select * from maintable where orderdate > 7 now() and actualdeliverydate = "".

I know the syntax cant be far off that but cant get it to work can anyone help?? Cheers
 
This should do it:

SELECT * FROM maintable WHERE (((actualdeliverydate) Is Null) AND ((DateDiff("d",[orderdate],Now()))>7));

Regards

Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top