2016-09-29 35 views

回答

0
SELECT t1.id, 
     t1.name 
FROM emp_table t1 
INNER JOIN     -- the join will remove employees who do not have 
(       -- two phone numbers in phone_table 
    SELECT Id 
    FROM phone_table   -- this query identifies all employees 
    GROUP BY Id    -- having two phone numbers in phone_table 
    HAVING COUNT(*) = 2 
) t2 
    ON t1.id = t2.Id 
相關問題