Re: [SQL] connectby

From: Benoît BOURNON <benoit(dot)bournon(at)adelis(dot)com>
To:
Cc: pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] connectby
Date: 2003-10-28 14:29:40
Message-ID: 3F9E7D54.9040805@adelis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

I use postgresql 7.2.3
How can I use connectby ??

Must I install files ? or packages ? or it is recommanded to upgrade
dataserver ?

George Essig wrote:

>>hi
>>
>>I have menu table:
>> id | integer | not null default
>>nextval('public.menu_id_seq'::text)
>> parent_id | integer |
>> description | text |
>>
>>I do select:
>>test=> SELECT * FROM connectby('menu','id','parent_id','2',0,'~') t(id
>>integer, parent_id integer, level int, branch text);
>> id | parent_id | level | branch
>>----+-----------+-------+-------------
>> 2 | | 0 | 2
>> 4 | 2 | 1 | 2~4
>> 7 | 4 | 2 | 2~4~7
>> 10 | 7 | 3 | 2~4~7~10
>> 16 | 10 | 4 | 2~4~7~10~16
>> 9 | 4 | 2 | 2~4~9
>>
>>How am I able to select description file from menu table, not only id,
>>parent_id, level, branch fields?
>>
>>--
>>WBR, sector119
>>
>>
>
>Try a join with the original table:
>
>SELECT t.*, description FROM connectby('menu','id','parent_id','2',0,'~')
>AS t(id integer, parent_id integer, level int, branch text), menu
>WHERE t.id = menu.id
>
>George Essig
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2003-10-28 14:29:52 Re: SELECT with row>32k hangs over SSL-Connection
Previous Message Brendan Jurd 2003-10-28 14:24:56 Re: Newbie-question

Browse pgsql-sql by date

  From Date Subject
Next Message BenLaKnet 2003-10-28 14:33:23 Re: [SQL] connectby
Previous Message D'Arcy J.M. Cain 2003-10-28 13:42:15 Re: URGENT!!! changing Column size