यह हमेशा होता है:
select *
from campaigns
where id not in (
select id_campaign from (
select e.id_campaign as id_campaign, d.frequency, e.id
from campaigns d left join served e on d.id = e.id_campaign
where d.status = 'Active'
group by e.id_campaign
having count(e.id) < d.frequency
)
)