Hi ,
Please help in how to do this . I want to extract hierarchical information along with count of sub nodes for each node .

For Example 1 has 11 sub nodes under it
2 has 4
3 has 0
4 has 2
9 has 3
taking the example of employees table i execute this query
select employee_id,
manager_id
,level
,LPAD(' ', LEVEL*3) || LAST_NAME AS LAST_NAME,
sys_connect_by_path (last_name , '/') sys_path_connection
from employees
start with manager_id is null
CONNECT BY PRIOR employee_id = manager_id
and last_name not in ( 'Kochhar' ,'Raphaely' ,'Weiss','Fripp' , 'Kaufling' , 'Vollman' , 'Mourgos' , 'Russell' , 'Partners'
,'Errazuriz' , 'Cambrault' ,'Hartstein' );
In this query , how i can get count of all subnodes under a node like under King , it should give me 13, under De Hann it should give me 5
100 1 | King /King | |
102 100 2 | De Haan /King/De Haan | |
103 102 3 | Hunold /King/De Haan/Hunold | |
104 103 4 | Ernst /King/De Haan/Hunold/Ernst | |
105 103 4 | Austin /King/De Haan/Hunold/Austin | |
106 103 4 | Pataballa /King/De Haan/Hunold/Pataballa | |
107 103 4 | Lorentz /King/De Haan/Hunold/Lorentz | |
149 100 2 | Zlotkey /King/Zlotkey | |
174 149 3 | Abel /King/Zlotkey/Abel | |
175 149 3 | Hutton /King/Zlotkey/Hutton | |
176 149 3 | Taylor /King/Zlotkey/Taylor | |
177 149 3 | Livingston /King/Zlotkey/Livingston | |
178 149 3 | Grant /King/Zlotkey/Grant | |
179 149 3 | Johnson /King/Zlotkey/Johnson | |