Posted by davisutt on 11/10/06 20:57
I'm trying to figure out how to this do with TSQL and preferably
through joins rather than by using cursors or temp tables. I have
multiple time spans for multiple individuals that I would like to
rollup together where they don't actually have a gap in coverage.
ID StartDate EndDate
Z000001 01/01/1996 9/30/1996
Z000001 10/01/1996 12/31/1998
Z000001 01/01/1999 04/30/1999
Z000001 01/01/2000 12/31/2000
Z000001 01/01/2001 12/31/2001
I would like to be able to "roll these up" in order to reflect the
actual time frames so that it would like this:
ID StartDate EndDate
Z000001 01/01/1996 4/30/1999
Z000001 01/01/2000 12/31/2001
4/30/1999 to 01/01/2000 is, of course, a legitimate break where there
was a date difference of more than one day.
Thanks in advance for any ideas.
Navigation:
[Reply to this message]
|