数据库
首页 > 数据库> > mysql 5.7查找递归树下的所有子任务

mysql 5.7查找递归树下的所有子任务

作者:互联网

select * from  (SELECT
    team_task_temp.* 
FROM
    ( SELECT * FROM team_task  ) team_task_temp,
    ( SELECT @pv := '825a43a940664a54b4bf20278b5e8952' ) initialisation 
WHERE
    find_in_set( pcode, @pv ) 
    AND length(
    @pv := concat( @pv, ',', CODE ))
    union 
    SELECT * FROM team_task  where code = '825a43a940664a54b4bf20278b5e8952'
    ) a
    where a.begin_time='2022-04-11'
    

 

标签:task,pv,temp,递归,5.7,team,mysql,where,SELECT
来源: https://www.cnblogs.com/huanghongbo/p/16168120.html