Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

Consulta com várias cláusulas IN em várias linhas

select distinct ID from table t1
where (select count(*) from table where ID = t1.ID group by ID) >=2
and (select count(*) from table where Idservice = 5 and ID = t1.ID group by ID) > 0