Re: Reporting by family tree

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Reporting by family tree
Дата
Msg-id CAKFQuwamjM=d9RHDc+OHEkeWiCGpQJL=sMSxJ_tzwETrx=75Ww@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Reporting by family tree  (Ibrahim Shaame <ishaame@gmail.com>)
Ответы Re: Reporting by family tree  (o1bigtenor <o1bigtenor@gmail.com>)
Список pgsql-novice
On Wed, Oct 25, 2023 at 5:21 AM Ibrahim Shaame <ishaame@gmail.com> wrote:
But what I want to get is  grandfather - father - children:

1 - Grandfather1

3 - father1-1

6 - son1-1

7 – son1-2

4 - Father1-2

8 - son2-1

2 – Grandfather2

5 - Father2-1

etc


Any suggestion



If you want a different ordering of the output change the ORDER BY specification.

Specifically, you want to order by the path of each person.  Since that can only be determined during the traversal you need to create the path data yourself.  I suggest using an integer[] (integer array) to store the path using ID values as breadcrumbs.

David J.

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

Предыдущее
От: Ibrahim Shaame
Дата:
Сообщение: Re: Reporting by family tree
Следующее
От: o1bigtenor
Дата:
Сообщение: Re: Reporting by family tree