This is a little complex, so it's best to build it in easy stages.
Assume you have three Employees:
EmpId EmpName Salary
1 Joe 1000
2 Fred 2000
3 Mike 3000
And some telephone numbers:
EmpId phoneNo
1 1111111
3 3333331
3 3333332
3 3333333
First, write a query that returns the EmpID and the number of phone numbers you have for them:
SELECT EmpId , COUNT(PhoneNo) AS pnc FROM ContectDetails
GROUP BY EmpId
EmpId pnc
1 1
3 3
You can then use this to JOIN with the Employee table:
SELECT * FROM Employee e
JOIN (SELECT EmpId , COUNT(PhoneNo) AS pnc FROM ContectDetails c
GROUP BY (c.EmpId)) s
ON e.EmpId = s.EmpId
As you can see, the first query slots in with little or no modification.
Empid EmpName Salary EmpId pnc
1 Joe 1000 1 1
3 Mike 3000 3 3
All you have to do then, is apply a WHERE clause to filter the results:
SELECT * FROM Employee e
JOIN (SELECT EmpId , COUNT(PhoneNo) AS pnc FROM ContectDetails c
GROUP BY (c.EmpId)) s
ON e.Empid = s.EmpId
WHERE pnc = 0
And
SELECT * FROM Employee e
JOIN (SELECT EmpId , COUNT(PhoneNo) AS pnc FROM ContectDetails c
GROUP BY (c.EmpId)) s
ON e.Empid = s.EmpId
WHERE pnc > 2