In Table-01, only one column(A/B/C/D) will be filled at a time. so end of the day I want to get all the filled columns values to one row. If column A filled 2 time in same day it should get the sum of those two. then the expected result is Table-02
Basically I want to reduced the number of rows in my table. How can I merge rows which have same date in to one row? Time should be ignored.
Table-01
Date | A | B | C | D |
---|---|---|---|---|
2020-10-14 00:00:00.000 | 2000 | NULL | NULL | NULL |
2020-10-14 11:32:19.350 | NULL | 1000 | NULL | NULL |
2020-10-14 20:56:33.217 | NULL | 1000 | NULL | NULL |
2020-10-19 15:04:10.760 | NULL | 1000 | NULL | NULL |
2020-10-19 16:21:28.553 | NULL | NULL | 2000 | NULL |
2020-11-02 15:57:41.277 | 1000 | NULL | NULL | NULL |
2020-11-03 08:20:54.137 | NULL | 1000 | NULL | NULL |
2020-11-03 13:38:06.117 | 2000 | NULL | NULL | NULL |
2020-11-03 13:39:04.137 | 2000 | NULL | NULL | NULL |
2020-11-03 13:41:53.857 | NULL | 3000 | NULL | NULL |
2020-11-03 13:43:07.780 | NULL | NULL | 4000 | NULL |
2020-11-03 13:43:51.780 | NULL | NULL | 4000 | NULL |
2020-11-03 13:44:32.330 | 2000 | NULL | NULL | NULL |
2020-11-03 13:46:44.293 | 2000 | NULL | NULL | NULL |
2020-11-05 07:43:25.553 | NULL | 3000 | NULL | NULL |
2020-11-05 07:44:44.853 | 4000 | NULL | NULL | NULL |
I want to convert this(^) to this(v)
Table-02
Date | A | B | C | D |
---|---|---|---|---|
2020-10-14 | 2000 | 2000 | NULL | NULL |
2020-10-19 | NULL | 1000 | 2000 | NULL |
2020-11-02 | 1000 | NULL | NULL | NULL |
2020-11-03 | 8000 | 4000 | 8000 | NULL |
2020-11-05 | 4000 | 3000 | NULL | NULL |