mysql函数实现递归查询,函数参数能不能当表名
1 回答
喵喔喔
TA贡献1735条经验 获得超5个赞
with a as
(select * from table1 where parentid=0
union all
select b.* from a,table1 b where a.id=b.parentid)
select * from a
用with as 来实现递归
添加回答
举报
0/150
提交
取消