pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
connectby
6+ messages / 6 participants
[nested] [flat]

* connectby
@ 2003-10-27 14:42 Sergei Levchenko <serg@city.gov.te.ua>
  0 siblings, 0 replies; 6+ messages in thread

From: Sergei Levchenko @ 2003-10-27 14:42 UTC (permalink / raw)
  To: pgsql-general@postgresql.org; pgsql-sql

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




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* connectby
@ 2003-10-27 14:47 sector119@mail.ru
  0 siblings, 0 replies; 6+ messages in thread

From: sector119@mail.ru @ 2003-10-27 14:47 UTC (permalink / raw)
  To: pgsql-general@postgresql.org; +Cc: pgsql-sql

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



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: connectby
@ 2003-10-28 02:23 George Essig <george_essig@yahoo.com>
  2003-10-28 14:29 ` Re: [SQL] connectby Benoît BOURNON <benoit.bournon@adelis.com>
  2003-10-28 14:33 ` Re: [SQL] connectby BenLaKnet <benlaknet@icqmail.com>
  0 siblings, 2 replies; 6+ messages in thread

From: George Essig @ 2003-10-28 02:23 UTC (permalink / raw)
  To: Sergei Levchenko <serg@city.gov.te.ua>; +Cc: pgsql-general@postgresql.org; pgsql-sql

> 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



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: [SQL] connectby
  2003-10-28 02:23 Re: connectby George Essig <george_essig@yahoo.com>
@ 2003-10-28 14:29 ` Benoît BOURNON <benoit.bournon@adelis.com>
  1 sibling, 0 replies; 6+ messages in thread

From: Benoît BOURNON @ 2003-10-28 14:29 UTC (permalink / raw)
  To: ; +Cc: pgsql-general@postgresql.org; 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@postgresql.org
>
>  
>

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: [SQL] connectby
  2003-10-28 02:23 Re: connectby George Essig <george_essig@yahoo.com>
@ 2003-10-28 14:33 ` BenLaKnet <benlaknet@icqmail.com>
  2003-10-28 15:04   ` Re: [SQL] connectby Joe Conway <mail@joeconway.com>
  1 sibling, 1 reply; 6+ messages in thread

From: BenLaKnet @ 2003-10-28 14:33 UTC (permalink / raw)
  To: ; +Cc: pgsql-general@postgresql.org; 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@postgresql.org
>
>  
>

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: [SQL] connectby
  2003-10-28 02:23 Re: connectby George Essig <george_essig@yahoo.com>
  2003-10-28 14:33 ` Re: [SQL] connectby BenLaKnet <benlaknet@icqmail.com>
@ 2003-10-28 15:04   ` Joe Conway <mail@joeconway.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Joe Conway @ 2003-10-28 15:04 UTC (permalink / raw)
  To: BenLaKnet <benlaknet@icqmail.com>; +Cc: pgsql-general@postgresql.org; pgsql-sql

BenLaKnet wrote:
> I use postgresql 7.2.3
> How can I use connectby ??
> 
> Must I install files ? or packages ? or it is recommanded to upgrade 
> dataserver ?

You need to upgrade. Either install 7.3.4 or wait a few weeks and 
install 7.4 when it is released.

Joe






^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2003-10-28 15:04 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-10-27 14:42 connectby Sergei Levchenko <serg@city.gov.te.ua>
2003-10-27 14:47 connectby sector119@mail.ru
2003-10-28 02:23 Re: connectby George Essig <george_essig@yahoo.com>
2003-10-28 14:29 ` Benoît BOURNON <benoit.bournon@adelis.com>
2003-10-28 14:33 ` BenLaKnet <benlaknet@icqmail.com>
2003-10-28 15:04   ` Joe Conway <mail@joeconway.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox