Quantcast
Channel: Hierarchical queries in Oracle - Stack Overflow
Browsing all 4 articles
Browse latest View live

Answer by Pranav Sri for Hierarchical queries in Oracle

It will give you the exact result you want:select connect_by_root(id) as root, id, parent_idfrom test1connect by prior id=parent_idstart with parent_id is not null;

View Article



Answer by Allan for Hierarchical queries in Oracle

The query you posted is missing the from clause and left an underscore out of connect_by_root, but I'll assume those aren't actually the source of your problem.The following query gives you the result...

View Article

Answer by A.B.Cade for Hierarchical queries in Oracle

try this: select connect_by_root(id) root_id, id, parent_idfrom your_tablestart with parent_id is nullconnect by prior id = parent_id

View Article

Hierarchical queries in Oracle

I have a table with a structure like (id, parent_id) in Oracle11g.id parent_id---------------1 (null)2 (null)3 14 35 36 27 2I'd like to query it to get all the lines that are hierarchically linked to...

View Article
Browsing all 4 articles
Browse latest View live




Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>