Search Postgresql Archives

GetHierarchy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux