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