Query time range

  • Thread starter Thread starter stillwalkingaway
  • Start date Start date
S

stillwalkingaway

hi. i was wondering how i would set a time range so that the
DBatch.start field will display a range from 6PM yesterday or
tuesday(any weekday) to 5:59PM the next day i.e. today/wednesday.
Here's what i have:

SELECT DBatch.batchname, DBatch.start AS StartTime, DBatch.end,
DBatch.duration, DBatch.recordcount
FROM DBatch
WHERE ????
ORDER BY DBatch.start;

Both the DBatch.start and the DBatch.end fields are in the Date/Time
format.
Thanks.
 
if you don't mind next /or previous day to be a holiday, saturday or sunday
SELECT DBatch.batchname, DBatch.start AS StartTime, DBatch.end,
DBatch.duration, DBatch.recordcount
FROM DBatch
WHERE DBatch.start >= Date() -1 + 18/24
AND DBatch.start < Date() + 18/24
ORDER BY DBatch.start;

else you'll have to use some calculations in addition
If I'm not mistaken Allen Browne has some excellent code to use to discount
Sa,Su & holidays

HTH

Pieter

And I'm aware 18/24 equals 3/4 equals 0.75 - but it's more understandable
(if not as fast) <g>
 
if you don't mind next /or previous day to be a holiday, saturday or sunday
SELECT DBatch.batchname, DBatch.start AS StartTime, DBatch.end,
DBatch.duration, DBatch.recordcount
FROM DBatch
WHERE DBatch.start >= Date() -1 + 18/24
AND DBatch.start < Date() + 18/24
ORDER BY DBatch.start;

else you'll have to use some calculations in addition
If I'm not mistaken Allen Browne has some excellent code to use to discount
Sa,Su & holidays

HTH

Pieter

And I'm aware 18/24 equals 3/4 equals 0.75 - but it's more understandable
(if not as fast) <g>



hi. i was wondering how i would set a time range so that the
DBatch.start field will display a range from 6PM yesterday or
tuesday(any weekday) to 5:59PM the next day i.e. today/wednesday.
Here's what i have:

SELECT DBatch.batchname, DBatch.start AS StartTime, DBatch.end,
DBatch.duration, DBatch.recordcount
FROM DBatch
WHERE ????
ORDER BY DBatch.start;

Both the DBatch.start and the DBatch.end fields are in the Date/Time
format.
Thanks.



--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top