我目前遇到了这个问题。假设我有以下每日数据
+-------------------------+-----+----+
| Date | C1 | C2 |
+-------------------------+-----+----+
| 2012-08-01 00:00:00.000 | 44 | 44 |
| 2012-08-02 00:00:00.000 | 51 | 49 |
| 2012-08-03 00:00:00.000 | 60 | 59 |
| 2012-08-04 00:00:00.000 | 68 | 67 |
| 2012-08-05 00:00:00.000 | 82 | 78 |
| 2012-08-06 00:00:00.000 | 62 | 59 |
| 2012-08-07 00:00:00.000 | 58 | 53 |
| 2012-08-08 00:00:00.000 | 69 | 65 |
| 2012-08-09 00:00:00.000 | 82 | 72 |
| 2012-08-10 00:00:00.000 | 70 | 68 |
| 2012-08-11 00:00:00.000 | 75 | 71 |
| 2012-08-12 00:00:00.000 | 64 | 64 |
| 2012-08-13 00:00:00.000 | 74 | 69 |
| 2012-08-14 00:00:00.000 | 60 | 56 |
| 2012-08-15 00:00:00.000 | 66 | 60 |
| 2012-08-16 00:00:00.000 | 57 | 51 |
| 2012-08-17 00:00:00.000 | 52 | 49 |
+-------------------------+-----+----+
我将如何对它进行分组,以便每周汇总 C1 和 C2?预期输出应该是
+---------------------------+------+----+
| Date | C1 | C2 |
+---------------------------+------+----+
| 2012-08-06 to 2012-12-12 | 480 | 452|
| 2012-08-13 to 2012-08-19 | 430 | 394|
+---------------------------+------+----+
它从 2012-08-06 开始,因为周期应该是周一到周日。我已经尝试了大约一个小时左右的谷歌搜索,似乎没有结果适合我的问题,我希望有人可以帮助我。
谢谢!