https://leetcode-cn.com/problems/find-the-subtasks-that-did-not-execute/
1767.pngselect a.task_id,convert(a.subtask_id,unsigned integer)subtask_id
from(
select a.task_id,b.subtask_id
from Tasks a,(
select @id:=@id+1 subtask_id from (select @id:=0) as init,Executed
)b
where a.subtasks_count>=b.subtask_id
order by a.task_id,b.subtask_id
)a left join Executed b on a.task_id=b.task_id and a.subtask_id=b.subtask_id
where b.task_id is null
网友评论