Compress (roll-up) table data
I need to roll-up rows (approx. 20 million) in a table, combining rows with continuous dates for the same ID. Ex.
ID Strt_dt End_Dt
1 1/1/2007 1/31/07
1 2/1/2007 2/28/2007
1 3/6/2007 3/30/2007
1 4/1/2007 4/30/2007
1 5/1/2007 5/31/2007
2 1/1/2007 1/31/07
2 2/1/2007 2/28/2007
2 3/1/2007 3/20/2007
2 4/1/2007 4/30/2007
2 5/1/2007 5/31/2007
Needs to be reduced to:
ID Strt_dt End_Dt
1 1/1/2007 2/28/2007
1 3/6/2007 5/31/2007
2 1/1/2007 3/20/2007
2 4/1/2007 5/31/2007
Any help would be GREATLY appreciated.
|