Gagan Gautam

Gagan Gautam

  • NA
  • 140
  • 14.2k

Hierarchical Data usign Self Join

Aug 5 2016 7:33 AM
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
31RetialNULL
32Mortgogages31
34UK Mortgages32
35Buy To Let32
36Credit Card31
37CorporateNULL



 
Output
e.g  
31 has 0 child
32 has 2 child
32 has 0 child 

Answers (6)