From: imad <immaad@gmail.com>
To: Alexander B. <burbello3000@yahoo.com.br>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: Hierarchical structure
Date: Sat, 10 Feb 2007 00:53:21 +0500
Message-ID: <1f30b80c0702091153u49f15ca1ycd0dbaa73f02d68a@mail.gmail.com> (raw)
In-Reply-To: <45CCCA4E.6080703@yahoo.com.br>
References: <45CCCA4E.6080703@yahoo.com.br>
There is a contrib module named tablefunc. It has a function
connect_by that can do some things like this. Check if it is
sufficient for you.
--Imad
www.EnterpriseDB.com
On 2/10/07, Alexander B. <burbello3000@yahoo.com.br> wrote:
> Hi, I need to create a view using hierarchical structure.
> Let me explain how is designed the table and what's the expected result.
>
> TABLE:
> coo_nro integer
> coo_nro_father integer
> level integer
>
>
> DATA:
> 100 – null – 1
> 106 – null – 1
> 134 – 100 – 2
> 725 – 100 – 2
> 635 – 106 – 2
> 423 – 134 – 3
> 814 – 725 – 3
>
>
> EXPECTED RESULT:
> 100 - 1
> 134 – 2
> 423 – 3
> 725 – 2
> 814 – 3
> 106 – 1
> 635 – 2
> . . . so on
>
> Basically, my result should be this way, not necessary spaces, but
> sorted by hierarchic.
>
> Is this possible on Postgres?
> Could you help me?
>
>
>
> _______________________________________________________
> Yahoo! Mail - Sempre a melhor opção para você!
> Experimente já e veja as novidades.
> http://br.yahoo.com/mailbeta/tudonovo/
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: immaad@gmail.com, burbello3000@yahoo.com.br
Subject: Re: Hierarchical structure
In-Reply-To: <1f30b80c0702091153u49f15ca1ycd0dbaa73f02d68a@mail.gmail.com>
References: <45CCCA4E.6080703@yahoo.com.br> <1f30b80c0702091153u49f15ca1ycd0dbaa73f02d68a@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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