I have a table that has several sets of dates. I am trying to generate a resultset that shows distinct time frames in which
the customer either had or different aid categories:
Table Cust
Customer_Nbr EFF_DATE END_DATE AID_CATG CATG_EFF_DATE CATG_END_DATE
000001 01/01/2012 12/31/2014 A1 04/01/2012 04/30/2012
000001 01/01/2012 12/31/2019 A2 06/01/2012 08/31/2012
000002 01/02/2012 12/31/2019 A3 01/02/2012 08/31/2012
..
Resultset I am trying to produce
Customer_Nbr EFF_DATE END_DATE AID_CATG
000001 01/01/2012 03/31/2012
000001 04/01/2012 04/30/2012 A1
000001 05/01/2012 05/31/2012
000001 06/01/2012 08/31/2012 A2
000001 09/01/2012 08/31/2019
I am looking at using analytical functions to make it scalable.
[Updated on: Sat, 06 July 2019 16:00] by Moderator
Report message to a moderator