Re: difficult select- question

From: Shakespeare <whatsin_at_xs4all.nl>
Date: Mon, 26 Oct 2009 15:58:46 +0100
Message-ID: <4ae5b91f$0$83232$e4fe514c_at_news.xs4all.nl>



Andreas Mosmann schreef:
> 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:
> F1|F2|F3|F4
> AA|BB|10|20
> AA|BB|20|30
> AA|BB|40|50
> AA|BB|50|60
> AA|BB|60|70
> AA|CC|70|80
> AA|CC|80|90
>
> 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
>
>
>
>
>

A question like this has been answered with a very simple, but beautiful

   select by Michel Cadot in
http://groups.google.com/group/comp.databases.oracle.misc/msg/78a21ddefd6507e6

Shakespeare Received on Mon Oct 26 2009 - 09:58:46 CDT

Original text of this message