22,300
社区成员




create table tb(id int,name varchar(10),level int,s varchar(100))
insert into tb select 1,'中国',0,null
insert into tb select 2,'河北',1,'1'
insert into tb select 3,'秦皇岛',2,'1-2'
insert into tb select 4,'海底世界',3,'1-2-3'
insert into tb select 5,'海宾浴场',3,'1-2-3'
insert into tb select 6,'山海关',2,'1-2'
insert into tb select 7,'老龙头',3,'1-2-6'
insert into tb select 8,'姜女庙',3,'1-2-6'
select * from tb where s like (select s+'-'+ltrim(id) from tb where name='河北')+'%'
and level=3
-- 0国家
-- 1省份
-- 2市
-- 3景点
/*
tree
-----------------
id
name
parentId -- required
rootid
level -- Optional
*/