potresti provare questa, se non ho capito male

Codice PHP:
SELECT group_idCOUNT(Distinct profile_id) as users 
FROM Message_group
WHERE profile_id 
=$mio_profile_id OR profile_id =$altro_profile_id
GROUP BY group_id
HAVING users 
>
Dovresti ottenere tutti i group_id dove sono presenti sia $mio_profile_id che $altro_profile_id