Re: Recursive select

Поиск
Список
Период
Сортировка
От Keith Gray
Тема Re: Recursive select
Дата
Msg-id 3BDDD39B.89A2A19C@heart.com.au
обсуждение исходный текст
Ответ на Recursive select  ("Jason Kwok" <jason@newhonest.com>)
Список pgsql-sql
Jason Kwok wrote:
> 
> I have a table :
> 
> MyID           parentID
> ================
> 5                    6
> 6                    7
> 3                    13
> 7                    3
> 
> Is there any simple select statement that can get all rows with MyID = 5 and
> all its parents?
> That means 5's parenet is 6, 6's parent is 7, 7's parent is 3.....
> 

I had a similar problem a couple of weeks back.
The only way I could get around it was "programmatically".
This is an iterative (loop) problem.

Because I am writing for several brands/flavours of database
I solved it in VB, but some solutions (for postgres only)
are offered using functions or triggers in PgSQL.

-- 
Keith Gray

Technical Development Manager
Heart Consulting Services P/L
mailto:keith@heart.com.au


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

Предыдущее
От: "Greg Sabino Mullane"
Дата:
Сообщение: Re: Recursive select
Следующее
От: "Greg Sabino Mullane"
Дата:
Сообщение: Re: Deletion Recursively