merge - How to get total production lost from Startdate to enddate for continous days -
basically idea identify down time start date end date continuous days , lost production.
i have data
completiondwid|completionmerrickid|downtimedescription|lostproduction|startdate|enddate 1456|2221|producer: shut in buildup|0.474951166666667|2016-12-28 00:00:00.000|2016-12-28 00:00:00.000 1456|2221|producer: shut in buildup|0.474951166666667|2016-12-29 00:00:00.000|2016-12-29 00:00:00.000 1456|2221|producer: shut in buildup|0.474951166666667|2016-12-30 00:00:00.000|2016-12-30 00:00:00.000 1456|2221|producer: shut in buildup|0.474951166666667|2016-12-31 00:00:00.000|2016-12-31 00:00:00.000 1456|2221|producer: shut in buildup|0.17691346 |2017-01-09 00:00:00.000|2017-01-09 00:00:00.000 1456|2221|producer: shut in buildup|0.17691346 |2017-01-10 00:00:00.000|2017-01-10 00:00:00.000 1456|2221|producer: shut in buildup|0.17691346 |2017-01-11 00:00:00.000|2017-01-11 00:00:00.000 1456|2221|producer: shut in buildup|0.17691346 |2017-01-12 00:00:00.000|2017-01-12 00:00:00.000 1456|2221|producer: shut in buildup|0.17691346 |2017-01-13 00:00:00.000|2017-01-13 00:00:00.000 1456|2221|producer: shut in buildup|0.17691346 |2017-01-14 00:00:00.000|2017-01-14 00:00:00.000 1456|2221|producer: shut in buildup|0.17691346 |2017-01-15 00:00:00.000|2017-01-15 00:00:00.000 1456|2221|producer: shut in buildup|0.676294926666667|2017-06-23 00:00:00.000|2017-06-23 00:00:00.000 1456|2221|producer: shut in buildup|0.51756477 |2017-06-24 00:00:00.000|2017-06-24 00:00:00.000 1456|2221|producer: shut in buildup|0.40645366 |2017-06-25 00:00:00.000|2017-06-25 00:00:00.000
i want data below
completiondwid|completionmerrickid|downtimedescription|lostproduction|startdate|enddate 1456|2221|producer: shut in buildup|1.899804667 |2016-12-28 00:00:00.000|2016-12-31 00:00:00.000 1456|2221|producer: shut in buildup|1.23839422 |2017-01-09 00:00:00.000|2017-01-15 00:00:00.000 1456|2221|producer: shut in buildup|1.600313357|2017-06-23 00:00:00.000|2017-06-25 00:00:00.000
i want achieve in sql server sql. value 1.899804667 summation of values date 2016-12-28 end date 2016-12-31. day 28 31 continuous days.
the value 1.600313357 summation of values date 2017-06-23 end date 2017-06-25. day 23 25 continuous days.
Comments
Post a Comment