pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedHierarchical structure
2+ messages / 2 participants
[nested] [flat]
* Hierarchical structure
@ 2007-02-09 19:23 Alexander B. <burbello3000@yahoo.com.br>
2007-02-09 19:53 ` Re: Hierarchical structure imad <immaad@gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Alexander B. @ 2007-02-09 19:23 UTC (permalink / raw)
To: pgsql-admin
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/
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Hierarchical structure
2007-02-09 19:23 Hierarchical structure Alexander B. <burbello3000@yahoo.com.br>
@ 2007-02-09 19:53 ` imad <immaad@gmail.com>
0 siblings, 0 replies; 2+ messages in thread
From: imad @ 2007-02-09 19:53 UTC (permalink / raw)
To: Alexander B. <burbello3000@yahoo.com.br>; +Cc: pgsql-admin
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
>
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2007-02-09 19:53 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-02-09 19:23 Hierarchical structure Alexander B. <burbello3000@yahoo.com.br>
2007-02-09 19:53 ` imad <immaad@gmail.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