Mysql
 sql >> Database >  >> RDS >> Mysql

Query con più clausole IN su più righe

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