Mysql
 sql >> Base de données >  >> RDS >> Mysql

L'opérande doit contenir 1 colonne - MySQL NOT IN

Il y a toujours ceci :

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 
    )
)