Re: another question about connectby from contrib - Mailing list pgsql-general

From Jan Weerts
Subject Re: another question about connectby from contrib
Date
Msg-id B349BABAF9A92F4D9FBFCADF8D5FEDD505A108@ivsrv03.i-views.de
Whole thread Raw
In response to another question about connectby from contrib  (sector119@mail.ru)
List pgsql-general
> id | parent_id | level | link |  text      | target | icon | node
>----+-----------+-------+------+------------+--------+------+------
>  8 |           |     0 |      | #3         |        |      | t
> 11 |         8 |     1 |      | #3.1       |        |      | t
> 12 |         8 |     1 |      | #3.2       |        |      | f
> 13 |        11 |     2 |      | #3.1.1     |        |      | f

If I get this right, you have a tree represented in a table in a bfs
order (by id) and want to output a dfs order (by text)?

>#3
>#3.1
>#3.1.1
>#3.1.2

so I guess you could simply add an "ORDER BY text" clause to your query
and be done as long as you don't have any really weird locale sorting this
text column in an unintuitive manner.

HTH
  Jan


pgsql-general by date:

Previous
From: danwlxiv@netscape.net (Dan Wells)
Date:
Subject: Searching for a guidance and a possible solution
Next
From: Hunter Hillegas
Date:
Subject: Re: Left Join Not Using Index?