I am trying to find out the records with dates overlapped or continous and then making it as a single record with the minimum date to the max date.
Here is the example of what i am trying to achieve.
|500||1||1. Jan. 2011||30. Jan. 2011|
|500||1||15. Feb. 2011||28. Feb. 2011|
|500||1||1. Mar. 2011||30. Mar. 2011|
|500||2||10. Apr. 2011||15. Oct. 2011|
|500||2||1. Jun. 2011||18. Oct. 2011|
|500||3||1. Jan. 2011||31. Jan. 2011|
|500||4||1. Jan. 2011||30. Jan. 2011|
|500||4||15. Feb. 2011||28. Feb. 2011|
|500||5||1. Mar. 2011||30. Mar. 2011|
|500||5||10. Apr. 2011||15. Oct. 2011|
|500||5||1. Jun. 2011||18. Oct. 2011|
|500||Corporate||1. Jan. 2011||30. Jan. 2011|
|500||Corporate||15. Feb. 2011||30. Mar. 2011|
|500||Corporate||10. Apr. 2011||18. Oct. 2011|
|500||Retail||1. Jan. 2011||30. Jan. 2011|
|500||Retail||15. Feb. 2011||30. Mar. 2011|
|500||Retail||10. Apr. 2011||18. Oct. 2011|
I tried the Row Preceeding option also the overlap function, but I am still not able to get the proper result. Please help me to solve this, incase you have encounter this scenario earlier or please point me to any existing thread talks about the same.
Thanks in advance.
Depends on your DB release
in 13.1 the following might give what you need
prio to 13.1 do a product join tp system calendar to achive the same
and don't forget the join to table two ;-)
I could really use some help in writing this query. I am new to Teradata and would appreciate any help on this issue. This issue has been a pain in my neck for the last 6 months and I cannot seem to find a way to consolidate consecutive date spans and/or overlapping date spans into one span (From date and TO Date)...I beseech you for some help on getting this written so I can finally get some relief.
Thank you so much
Please look at this post by dieter back in 2010,
This must help you... if I understand your situation correctly.