connectby usage question

Поиск
Список
Период
Сортировка
От Eric E
Тема connectby usage question
Дата
Msg-id 455A474F.5090008@gmail.com
обсуждение исходный текст
Ответы Re: connectby usage question  (Joe Conway <mail@joeconway.com>)
Re: connectby usage question  (Jim Nasby <jim@nasby.net>)
Список pgsql-general
Hi all,
    We're trying to use connectby to transform a tree into an ordered set
of rows, specifically requirements rows.

We have data stored in a table with
keyid and parent_id, as described in the examples for

keyid is also the primary key of a table A, which has the field
A.seq_number.

We can successfully sort the output of connectby using seqnumber.
connectby does return as branch the concatenation of the keyids from
root to leaf for each branch.

However, we would like to return a numbering the items based on the
order they return, like so;

1 (first item)
1.1 (1 branch, 1st item)
1.2 (1 branch, 2nd item)
1.2.1 (1.2 branch, 1st item)
1.2.2
1.2.2.1
1.3
2
2.1
2.1.1
2.1.2
2.1.3
2.2
2.3

etc.
Is there an option in connectby to do this directly, or do we need to
write another function to do this?

Thanks,

Eric




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

Предыдущее
От: John McCawley
Дата:
Сообщение: Re: The old Insert and retrieving your Serial problem in
Следующее
От: Desmond Coughlan
Дата:
Сообщение: RE : Re: database design ...