I have some data that needs to be merged when dates overlap before I can run a process. Each record contains a memberID (INT), Value1 (INT), StartDate (Date), EndDate(Date). In any case when dates overlap for a member, I merge these into 1 record, which has the sum of Value1 and adjusted StartDate and EndDate.
Example1:
MemberID, Value1, StartDate, EndDate
201 4 2015-6-20 2015-6-22
201 2 2015-6-22 2015-6-24
would need to become:
MemberID, Value1, StartDate, EndDate
201 6 2015-6-20 2015-6-24
Example2:
MemberID, Value1, StartDate, EndDate
201 0 2015-7-15 2015-7-16
201 2 2015-7-18 2015-7-22
201 2 2015-7-21 2015-7-22
should become
MemberID, Value1, StartDate, EndDate
201 0 2015-7-15 2015-7-16
201 4 2015-7-18 2015-7-22
Anyone have any ideas on how I should go about this?
Thanks.