TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Atul Patil
NA
586
73.7k
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
Reply
Answers (
5
)
How to pivot bellow table??
Implicit conversion from varchar to varbinary not allowed