Hi,
I have a table with ranges of date:
| Activity ID | Customer ID | Start Date | End Date |
|---|
| 1 | 123 | 1 may 2017 | 15 june 2017 |
| 2 | 456 | 10 may 2017 | 18 july 2017 |
| 3 | 123 | 20 may 2017 | 20 june 2017 |
| 4 | 123 | 1 january 2017 | 20 january 2017 |
I have to create a function that return the number of different days of activity from this table. So, if a day is in two or more ranges I have to count it one time only.
In this case, for Customer ID = 123, the function may return 46, because the days between 20 may and 15 june in activity IDs 1 and 3 are counted one time only.
Thanks in advance.