this is my table with ParentId column. now i want make parent and child in this given table using self join.
I searched on internet but these is not good solution.I am using this table in Entity Framwork
My Table
___________________________
ID Title ParentId
31 | Retial | NULL |
32 | Mortgogages | 31 |
34 | UK Mortgages | 32 |
35 | Buy To Let | 32 |
36 | Credit Card | 31 |
37 | Corporate | NULL |
|
|
|
Output
e.g
31 has 0 child
32 has 2 child
32 has 0 child