Re: LinkedList

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: LinkedList
Дата
Msg-id 1146067158.23538.264.camel@state.g2switchworks.com
обсуждение исходный текст
Ответ на LinkedList  ("Ray Madigan" <ray@madigans.org>)
Ответы Re: LinkedList  ("Ray Madigan" <ray@madigans.org>)
Re: LinkedList  ("Ben K." <bkim@coe.tamu.edu>)
Список pgsql-sql
On Wed, 2006-04-26 at 11:09, Ray Madigan wrote:
> I have a table that I created that implements a linked list.  I am not an
> expert SQL developer and was wondering if there are known ways to traverse
> the linked lists.  Any information that can point me in the direction to
> figure this out would be appreciated.  The table contains many linked lists
> based upon the head of the list and I need to extract all of the nodes that
> make up a list.  The lists are simple with a item and a link to the history
> item so it goes kind of like:
> 
> 1, 0
> 3, 1
> 7, 3
> 9, 7
> ...
> 
> Any suggestions would be helpful, or I will have to implement the table
> differently.

You should be able to do this with a fairly simple self-join...

select a.id, b.aid, a.field1, b.field1 
from mytable a
join mytable b
on (a.id=b.aid)

Or something like that.


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Ray Madigan"
Дата:
Сообщение: LinkedList
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Migrating a Database to a new tablespace