Query that searches historical Business Days

joeserrone

The cat of the cul-de-sac
Local time
Today, 02:19
Joined
Dec 17, 2006
Messages
164
Hello Everyone,
I have a table called Table1 that amongst other data is capturing a Timestamp when records are added. I want to create a query that looks at the latest logged Date and only display to me records that are 6 business days or older. For example if I have records with a timestamp as follows
05/09/08 6:00 P.M.
05/08/08 3:00 P.M.
05/07/08 12:00 P.M.
05/06/08 10:00 A.M.
05/05/08 9:30 A.M.
05/02/08 6:30 A.M.
05/01/08 2:00 A.M.


I want this query to basically display to me ONLY the records from:
05/02/08 6:30 A.M.
05/01/08 2:00 A.M.

Keep in mind that I want this by business day Monday through Friday.

I can conceptualize this situation but not sure how I go about creating a query that will do that.

Thanks
 
Try this query:-

SELECT *
FROM [Table1]
WHERE DateValue([TimeStamp]) < (Select Top 1 DateValue([TimeStamp]) from [Table1] order by [TimeStamp] desc)-6;

.
 
error message

When I try running this query I get a "Data Type mismatch in criteria expression"
 

Users who are viewing this thread

Back
Top Bottom