mysql函數(shù)實現(xiàn)遞歸查詢,函數(shù)參數(shù)能不能當(dāng)表名
1 回答

喵喔喔
TA貢獻(xiàn)1735條經(jīng)驗 獲得超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 來實現(xiàn)遞歸
添加回答
舉報
0/150
提交
取消