亿华智慧云亿华智慧云

SQL遍历父子关系表的测试

SQL遍历父子关系表的测试
复制Create Table A   (ID Int,遍表   fatherID Int,   Name Varchar(10)   )   Insert A Select 1,        NULL,       tt   Union All Select 2,        1,          aa   Union All Select 3,        1,          bb   Union All Select 4,        2,          cc   Union All Select 5,        2,          gg   Union All Select 6,        4,          yy   Union All Select 7,        4,          jj   Union All Select 8,        7,           ll   Union All Select 9,        NULL, uu   Union All Select 10,       9,         oo   GO  1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.
赞(2618)
未经允许不得转载:>亿华智慧云 » SQL遍历父子关系表的测试