Hallo Zusammen,
ich komme gerade nicht weiter und hoffe, dass Ihr mir helfen könnt.
Ich habe folgende Daten
[highlight=sql]
with data as
(select '1' as id,TO_DATE('01.01.2010') as VON_1,TO_DATE('30.04.2010') as BIS_1,TO_DATE('01.01.2010') as VON_2,
TO_DATE('31.05.2010') as BIS_2 from DUAL union all
select '1',TO_DATE('01.05.2010'),TO_DATE('01.01.9999'),TO _DATE('01.06.2010'),TO_DATE('01.01.9999') from DUAL union all
select '2',TO_DATE('01.01.2005'),TO_DATE('01.01.2009'),TO _DATE('01.01.2005'),TO_DATE('01.01.2009') from DUAL union all
select '2',TO_DATE('05.01.2009'),TO_DATE('30.04.2010'),TO _DATE('05.01.2009'),TO_DATE('30.04.2010') from DUAL union all
select '3',TO_DATE('01.01.2010'),TO_DATE('30.04.2010'),TO _DATE('30.04.2010'),TO_DATE('30.04.2010') from DUAL union all
select '3',TO_DATE('30.04.2009'),TO_DATE('30.04.2010'),TO _DATE('01.05.2010'),TO_DATE('30.04.2010') from DUAL union all
select '3',TO_DATE('01.05.2010'),TO_DATE('01.10.2010'),TO _DATE('02.05.2010'),TO_DATE('01.10.2010') from DUAL union all
select '3',TO_DATE('02.10.2010'),TO_DATE('01.10.2011'),TO _DATE('02.05.2010'),TO_DATE('01.01.9999') from DUAL union all
select '3',TO_DATE('02.10.2011'),TO_DATE('01.01.9999'),TO _DATE('02.05.2010'),TO_DATE('01.01.9999') from DUAL union all
select '4',TO_DATE('01.01.2010'),TO_DATE('01.10.2011'),TO _DATE('01.01.2010'),TO_DATE('01.10.2011') from DUAL union all
select '4',TO_DATE('02.12.2011'),TO_DATE('13.05.2011'),TO _DATE('02.05.2010'),TO_DATE('01.10.2011') from DUAL union all
select '4',TO_DATE('13.05.2011'),TO_DATE('01.01.9999'),TO _DATE('01.10.2011'),TO_DATE('01.01.9999') from DUAL)select * from data;
[/highlight]
Ich muss herrausfinden, bei wem die Zeiträume, kummuliert über die ID durchgehen sind.
Für diesen Fall benötige ich einen DS mit dem minimum des von und des maximums des bis.
Bsp
4 01.01.2010 01.01.9999
Falls nicht durchgehend, jeden einzelnen Zeitraum
Bsp
2 01.01.2005 01.01.2009 01.01.2005 01.01.2009
2 05.01.2009 30.04.2010 05.01.2009 30.04.2010
Und dies für beide Datumspaare, also von_1/bis_1 sowie von_2/bis_2
Vielen Dank im voraus
Vielöe Grüße
Martin
ich komme gerade nicht weiter und hoffe, dass Ihr mir helfen könnt.
Ich habe folgende Daten
[highlight=sql]
with data as
(select '1' as id,TO_DATE('01.01.2010') as VON_1,TO_DATE('30.04.2010') as BIS_1,TO_DATE('01.01.2010') as VON_2,
TO_DATE('31.05.2010') as BIS_2 from DUAL union all
select '1',TO_DATE('01.05.2010'),TO_DATE('01.01.9999'),TO _DATE('01.06.2010'),TO_DATE('01.01.9999') from DUAL union all
select '2',TO_DATE('01.01.2005'),TO_DATE('01.01.2009'),TO _DATE('01.01.2005'),TO_DATE('01.01.2009') from DUAL union all
select '2',TO_DATE('05.01.2009'),TO_DATE('30.04.2010'),TO _DATE('05.01.2009'),TO_DATE('30.04.2010') from DUAL union all
select '3',TO_DATE('01.01.2010'),TO_DATE('30.04.2010'),TO _DATE('30.04.2010'),TO_DATE('30.04.2010') from DUAL union all
select '3',TO_DATE('30.04.2009'),TO_DATE('30.04.2010'),TO _DATE('01.05.2010'),TO_DATE('30.04.2010') from DUAL union all
select '3',TO_DATE('01.05.2010'),TO_DATE('01.10.2010'),TO _DATE('02.05.2010'),TO_DATE('01.10.2010') from DUAL union all
select '3',TO_DATE('02.10.2010'),TO_DATE('01.10.2011'),TO _DATE('02.05.2010'),TO_DATE('01.01.9999') from DUAL union all
select '3',TO_DATE('02.10.2011'),TO_DATE('01.01.9999'),TO _DATE('02.05.2010'),TO_DATE('01.01.9999') from DUAL union all
select '4',TO_DATE('01.01.2010'),TO_DATE('01.10.2011'),TO _DATE('01.01.2010'),TO_DATE('01.10.2011') from DUAL union all
select '4',TO_DATE('02.12.2011'),TO_DATE('13.05.2011'),TO _DATE('02.05.2010'),TO_DATE('01.10.2011') from DUAL union all
select '4',TO_DATE('13.05.2011'),TO_DATE('01.01.9999'),TO _DATE('01.10.2011'),TO_DATE('01.01.9999') from DUAL)select * from data;
[/highlight]
Ich muss herrausfinden, bei wem die Zeiträume, kummuliert über die ID durchgehen sind.
Für diesen Fall benötige ich einen DS mit dem minimum des von und des maximums des bis.
Bsp
4 01.01.2010 01.01.9999
Falls nicht durchgehend, jeden einzelnen Zeitraum
Bsp
2 01.01.2005 01.01.2009 01.01.2005 01.01.2009
2 05.01.2009 30.04.2010 05.01.2009 30.04.2010
Und dies für beide Datumspaare, also von_1/bis_1 sowie von_2/bis_2
Vielen Dank im voraus
Vielöe Grüße
Martin
Comment