You can also use self outer join:
Code:SELECT t1.div_id, t1.div_name, COUNT(t2.div_id) AS childcount FROM divsion t1, division t2 WHERE t1.parent_id = 0 AND t1.div_id = t2.parent_id(+) GROUP BY t1.div_id, t1.div_name
|
Results 1 to 5 of 5
Threaded View
|
Click Here to Expand Forum to Full Width |