VA
Size: a a a
VP
SM
select tt.*
from task_templates tt
left join (select ttt.task_template_id
, bool_or(t.published) as any_published
from task_templates_tasks ttt
join tasks t on ttt.task_id = t.id
group by ttt.task_template_id) subquery on tt.id = subquery.task_template_id
where subquery.task_template_id is null
or not subquery.any_published;
SM
T
T
AT
LL
VA
SM
ŹR
АН
ŹR
ŹR
АН
АН
ŹR
ŹR
ŹR
ŹR