之前項(xiàng)目中就遇到查詢所有部門(mén)層級(jí)的需求,當(dāng)時(shí)MySQL用的5.7的版本,然后我是自定義了一個(gè)函數(shù)實(shí)現(xiàn)了,當(dāng)然,函數(shù)里面實(shí)際也是遞歸查詢。
2021-01-29
<img src=x onerror=alert("1&2+'a'")>
2020-01-19
with recursive fb_list(n1, n2) as
(
select 0, 1
union all
select n2, n1+n2 from fb_list where n1 + n2 <=100
)
select 0
union all
select n2 from fb_list;
(
select 0, 1
union all
select n2, n1+n2 from fb_list where n1 + n2 <=100
)
select 0
union all
select n2 from fb_list;
2019-11-05