C(6%AEZG_09%5QZ5XZ4KC%B.png
    ![7{(]BNZDCSVZ8@N]NKY@XW.png


    还是递归查询的使用,只不过这次里面有2个变量,另外尽量避免用not in, 用了经常超时

    1. with recursive t(task_id, subtask_id) as
    2. (
    3. select task_id, subtasks_count from Tasks
    4. union all
    5. select task_id, subtask_id - 1 from t where subtask_id >= 2
    6. )
    7. select t.* FROM t left join Executed E
    8. on (t.task_id,t.subtask_id) = (E.task_id,E.subtask_id)
    9. where E.task_id is null