X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 69D47D1B517 for ; Tue, 28 Oct 2003 02:24:25 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 84572-02 for ; Mon, 27 Oct 2003 22:23:57 -0400 (AST) Received: from web80208.mail.yahoo.com (web80208.mail.yahoo.com [66.218.79.43]) by svr1.postgresql.org (Postfix) with SMTP id 4EF60D1B4FE for ; Mon, 27 Oct 2003 22:23:53 -0400 (AST) Message-ID: <20031028022356.45528.qmail@web80208.mail.yahoo.com> Received: from [68.89.145.95] by web80208.mail.yahoo.com via HTTP; Mon, 27 Oct 2003 18:23:56 PST Date: Mon, 27 Oct 2003 18:23:56 -0800 (PST) From: George Essig Subject: Re: connectby To: Sergei Levchenko Cc: pgsql-general@postgresql.org, pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/1345 X-Sequence-Number: 51417 > 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