Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Parent to Child and subchilds Expand / Collapse
Author
Message
Posted Tuesday, February 12, 2013 10:18 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, February 14, 2013 2:25 AM
Points: 3, Visits: 9
Hi All,

I need an urgent help to build some logic in Oracle DB.

I have a table called TREE and in that we have data based on hierarchies.
We have columns like DataID and ParentID and DataID column is unique one.

And the data for DataID and ParentID will be this is like parent and child relation ship.
I need to get the count of all DataID's and Sub-dataID's of ParentID.

I need to get the count of this without using Start With connect by option.

Is there a way to get this done...

Thanks
Anilkumar B
Post #1419084
Posted Friday, February 15, 2013 2:05 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 9:22 PM
Points: 1,403, Visits: 6,900
if the oracle is 11.2 or later you can use recursive WITH-sql instead of connect by
Post #1420758
Posted Friday, February 15, 2013 4:05 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 7:27 AM
Points: 35,769, Visits: 32,437
anilkumar04_b (2/12/2013)
Hi All,
I need to get the count of this without using Start With connect by option.


Why? Whats wrong with the CONNECT BY option?


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1420823
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse