Re: double linked list - Mailing list pgsql-sql

From DA Morgan
Subject Re: double linked list
Date
Msg-id 3E36B3A1.43E424F3@exesolutions.com
Whole thread Raw
In response to double linked list  (jasche@gmx.de (Juergen))
List pgsql-sql
Juergen wrote:

> Hi folks!,
>
> I've got a table called 'link_t' containing a collection of seller -
> buyer relations between two parties.
>
> sql> select * from link_t
>
> S B
> - -
> C X
> A B
> B C
> C D
> D E
>
> 5 rows selected.
>
> I am looking for a select statement that returns the concatenation of
> seller - buyer relations between the first seller 'A' and the last
> buyer 'B'.
>
> the result should be
>
> S B
> - -
> A B
> B C
> C D
> D E
>
> Currently I fumbling around with self joins but haven't figured out
> yet.
> Any suggestions
>
> Many tanks in advance
>
> Cheers
>
> Juergen

Look at the CONNECT BY built-in function.

Daniel Morgan



pgsql-sql by date:

Previous
From: "Wei Weng"
Date:
Subject: Re: converting microsoft sql server 2000 sql-code for postgresql
Next
From: "codeWarrior"
Date:
Subject: Re: Rename database?