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

sum up between certain dates-tsql query

$
0
0

Hi,

We have a following scenario,

DATE

MONTH start

MONTH end

IS BUSINESS DAY

2014-02-23

2014-02-01

2014-02-28

0

2014-02-24

2014-02-01

2014-02-28

1

2014-02-28

2014-02-01

2014-02-28

1

For example, if date 2014-02023 is chosen, then we need to sum total business days for the whole month. Table is similar as above,

select * from  A where date = '2014-02-23'. If we choose this day, then need to sum for column "is business day" for all rows with month end of '2014-02-28, month start of '2014-02-01' .

Is ther any easier way to calculate this? Appreciate for your feedback.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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