Atul Patil

Atul Patil

  • 1k
  • 586
  • 69.4k

How to weekly group a data

Mar 21 2017 1:10 AM
I'm currently stuck with this problem. Suppose I have the following daily data
 
+-------------------------------+----------
|                  Date               | Total  |
+-------------------------------+----------
| 2016-08-01 00:00:00.000 | 10 |
| 2016-08-02 00:00:00.000 | 10 |
| 2016-08-03 00:00:00.000 | 20 |
| 2016-08-04 00:00:00.000 | 40 |
| 2016-08-05 00:00:00.000 | 20 |
| 2016-08-06 00:00:00.000 | 10 |
| 2016-08-07 00:00:00.000 | 50 |
| 2016-08-16 00:00:00.000 | 57 |
| 2016-08-17 00:00:00.000 | 52 |
+-------------------------+-----+----------
 
 
 
 How will I group it in such a way that it will sum Total by weekly basis? Expected output should be
 
 
2012-08-01 to 2012-08-07 = 160
2012-08-08 to 2012-08-15=0
 
 
 

Answers (5)