From: | bhanu udaya <udayabhanu1984(at)hotmail(dot)com> |
---|---|
To: | Kevin Grittner <kgrittn(at)mail(dot)com>, Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Cc: | Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, Chris Travers <chris(dot)travers(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net> |
Subject: | GetHierarchy |
Date: | 2013-03-01 02:18:01 |
Message-ID: | COL002-W114EF75CA410096085E1C2FD3FF0@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgadmin-support pgsql-general |
Greetings !
I have a hierarchy table with two attributes : Parent_ID, Child_ID with the sample data (can go upto n-level) as below:
ParentID
ChildID
1
3
1
4
3
5
5
6
6
7
I need a query to retrieve all the n level hierarchy when a Child node_id is passed. For example; if I pass 7, then i need parent nodes as below: I want to achive this in postgres database (version 9.2) without connect by prior.
3 5
5 6
6 7
Any reply on this is great help.
Thanks and REgards
RAdha Krishna
From | Date | Subject | |
---|---|---|---|
Next Message | bhanu udaya | 2013-03-01 04:14:15 | Re: GetHierarchy |
Previous Message | Guillaume Lelarge | 2013-02-28 22:23:28 | Re: pgadmin3 1.6.1, role editing bug |
From | Date | Subject | |
---|---|---|---|
Next Message | bhanu udaya | 2013-03-01 04:14:15 | Re: GetHierarchy |
Previous Message | Tom Duffey | 2013-03-01 01:55:15 | Re: Floating point error |