select distinct id,name,fatherid from db_datadictionary where deleteflag = 0 and id>=100000000
start with id in (select c.cityid from db_cityserversort c where c.deleteflag = 0) connect by prior fatherid = id
union all
select sys_serial id,servername name, cityid fatherid from db_cityserversort c where c.SERVERSORTID=31 and c.deleteflag = 0这个语句在ORCAL下是正确的,但MYSQL不支持start with in的用法,请问可以怎么改一下
start with id in (select c.cityid from db_cityserversort c where c.deleteflag = 0) connect by prior fatherid = id
union all
select sys_serial id,servername name, cityid fatherid from db_cityserversort c where c.SERVERSORTID=31 and c.deleteflag = 0这个语句在ORCAL下是正确的,但MYSQL不支持start with in的用法,请问可以怎么改一下
你要用递归的话 可以写存储过程
或者是代码里写比较好
ID FATHERID
1 NULL
2 1
3 1
4 1|2
5 1|2|4
6 1|2|4|5
.........不知道是否能满足呢?