Number of Oracle Query tree structure nodes

Source: Internet
Author: User

                                      The tree-like structure is as follows
202913684831 Lu Jing Lu 202913684833-------------Yuexiu Road 202913684837--------Tianhe District 202913684832, 202913684830--------, Yuexiu District, Guangdong province---- 202913684838 Tianhe Road,---------The first waySelect A.treegroup_id,a.treegroup_parent,a.treegroup_name, (select COUNT (*) from J_treedepot bwhere B.treegroup_ parent=a.treegroup_id) Sub_cntfrom j_treedepot awhere a.treegroup_parent=202913684830order by 1;The second wayWith parent as (select A.treegroup_parent, COUNT (*) Sub_cntfrom j_treedepot agroup by A.treegroup_parentorder by 1) Select a.treegroup_id, A.treegroup_name, NVL (b.sub_cnt,0) Sub_cntfrom J_treedepot aleft join parent B on a.treegroup_id= B.treegroup_parentwhere A.treegroup_parent=202913684830order by 1table structure is as follows

Number of Oracle Query tree structure nodes

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.