How to get all Childs and subchilds of a parent

  • 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

  • anilkumar04_b (2/13/2013)


    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

    Welcome to SSC. There is no way we can help with the limited amount of information you have posted. We would need to see ddl (create table scripts) and sample data (insert statements) in addition to desired output. Please take a few minutes to read the article found at the first link in my signature for best practices when posting questions.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply