• I'm thinking that you might want to include "business hours" on weekends. The easiest way to do it would be using DATEPART. However, you might encounter with the problem of holidays and there's where a calendar table will help you.

    You would end up with something like this depending on your calendar table.

    Select sum(abncalls)

    from TABLE t

    JOIN CalendarTable c ON t.date = c.date

    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)

    or is_workday = 0)

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2