View Full Version : Simple Date Query - urgent answer required


cos01
02-11-2002, 06:38 AM
Hi all,

I am developing a database which among others has 2 fields containing a "Received Date" and a "Reply Date" respectively. I would like a query in SQL format which will filter all records where reply date is within 14 days of the received date.

Thanks

Craig

[This message has been edited by cos01 (edited 02-11-2002).]

Ally
02-11-2002, 08:28 AM
Craig

I’ve done it with making a new “field” and entering a DateDiff in a query which works out the number of days and then entering <=14 in the criteria of the DateDiff field which then returns the records you require.

There is probably a more efficient way of doing it, but this may tide you over until you get something better.

*** *** *** *** ***
SELECT Dates.ReceivedDt, Dates.ReplyDt, DateDiff("d",[receiveddt],[replydt]) AS Days
FROM Dates
WHERE (((DateDiff("d",[receiveddt],[replydt]))<=14));

*** *** *** *** ***

Ally

[This message has been edited by Ally (edited 02-11-2002).]