difficult select- question

From: Andreas Mosmann <mosmann_at_expires-31-10-2009.news-group.org>
Date: Mon, 26 Oct 2009 13:08:52 +0100
Message-ID: <1256558932.12_at_user.newsoffice.de>

Hi ng,

I hope, there is someone with a good idea concerning the following question:

There is a sorted Table (or view) like the following:


As you can see there are some rows, that are connected by F3=prior F4, but there are leaks too. I need a result as the following:

AA|BB|10|30|2 parts
AA|BB|40|70|3 parts
AA|CC|70|90|2 parts

I know it is easy to solve by programming. I think it is possible to do this with inline view and hierarchical query.
I can imagine a way by select min(F3), max(F4) ... where exists (enough connecting data in the middle).

But what is the best (SQL-)way to solve this? (There actually are about 15000 lines, the estimated result probably should not have more than 100 lines)
I could do it by PL/SQL, but I am interested in SQL, if exists

Andreas Mosmann

wenn email, dann AndreasMosmann <bei> web <punkt> de
Received on Mon Oct 26 2009 - 07:08:52 CDT

Original text of this message