Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Include weekends in date range

$
0
0
Hello,

I have a query that aggregates a value based on a date range and excludes business hours. I need to INCLUDE Saturday and Sunday based on the date range. I am stuck and I think I am at that time of day where your brain decides to quit. Time for some coffee :)

Here is what I have so far and as always, thank you all very much for your help!

declare @StartDate datetime, @EndDate datetime

set @StartDate = '6/1/2013'
set @EndDate = '6/30/2013'

Select sum(abncalls)
from TABLE
where date between @StartDate) and (@EndDate)
and starttime not in (800,830,900,930,1000,1030,1100,1130,1200,1230,1300,1330,1400,1430,1500,1530,1600,1630)




Dave SQL Developer


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>