Which Oracle SQL-technique is possible to use for concatenate this rows:
id | from | to
--------------
a | 20 | 25
a | 26 | 30
a | 32 | 40
b | 1 | 5
b | 7 | 10
b | 11 | 20
for such result:
a | 20 | 30
a | 32 | 40
b | 1 | 5
b | 7 | 20
? Assumed that from
and to
is start and end of an integer period, and necessary to choose an non-breaking periods for id
's
Just looking for right direction and example, can this be done using group by
or connect by
or something else?
DB is Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production