日期:2014-05-16  浏览次数:20994 次

oracle树形结构表查询语句
现有表:
id(不重复)   父级id         地区名字         级别
dist_id             parent_id      dist_name     dist_type
1                           0                        中国               0
2                           1                        北京               1
52                         2                        北京               2
500                      52                     朝阳区            3
501                      52                     东城区            3
3                          1                          安徽              1
36                        3                          安庆             2
399                     36                         大观区         3
……………………………………………………
就是这样的表,省市区都在一张表里面,现在想查询出这样的:
id             父级id          省            市            区              级别
2                     1 &nbs