select a.projectId from
(select distinct projectId from table where domainId = 2) a,
(select distinct projectId from table where domainId = 3) b
where a.projectId = b.projectId
select a.projectid from
(select distinct projectid from table where domainid = 2 ) a,
(select distinct projectid from table where domainid = 3 ) b
where a.projectid = b.projectid