Exclude rows with unique values in one column from grouped mysql query
You can use COUNT(DISTINCT xxx) in this way:

select distinct user_id, project_id
from   t
where  project_id in (select   project_id
                      from     t
                      group by project_id
                      having   count(distinct user_id) &gt; 1);




user_id | project_id
------: | ---------:
   6342 |       1003
   6318 |       1003



db&lt;>fiddle here