Try this (revised code)
SELECT DISTINCT EmpId, ProjectId FROM TableX WHERE EmpId IN ( SELECT EmpId FROM TableX GROUP BY EmpId HAVING COUNT (DISTINCT ProjectId) > 1 )
That should give you
EmpId ProjectId ----------- ----------- 100 500 100 501 100 502 3 row(s)
Edit Content added for optional OPs question in comments
The account that distint ProjectIds gives you will mean that GROUP BY will be at EmpId
level and there is no need for a subquery
SELECT EmpId, Count (Distinct ProjectId) Projects FROM TableX GROUP BY EmpId
To get the number of projects for all employees with multiple projects, do the following
SELECT EmpId, Count (Distinct ProjectId) Projects FROM TableX GROUP BY EmpId Having Count (Distinct ProjectId) > 1
source share