之前项目中就遇到查询所有部门层级的需求,当时MySQL用的5.7的版本,然后我是自定义了一个函数实现了,当然,函数里面实际也是递归查询。
                
                    
                    2021-01-29
                
            MySQL 8.0增加了好多功能,发现了老师的一个SQL专栏:https://gitbook.cn/gitchat/column/5dae96ec669f843a1a4aed95
                
                    
                    2020-02-08
                
            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
                
             
             
        












