答案 0 :(得分:1)
您可以使用EXISTS
执行此操作(首选方法)
SELECT *
FROM yourtable t1
WHERE EXISTS (SELECT 1
FROM yourtable t2
WHERE t1.EMPLOYEEID = t2.EMPSUPERVISOR)
使用IN
运算符
SELECT *
FROM yourtable t1
WHERE t1.EMPLOYEEID IN (SELECT t2.EMPSUPERVISOR
FROM yourtable t2)
使用JOIN
SELECT t1.*
FROM yourtable t1
JOIN (SELECT DISTINCT EMPSUPERVISOR
FROM yourtable) t2
ON t1.EMPLOYEEID = t2.EMPSUPERVISOR
答案 1 :(得分:0)
我会说:
SELECT EMPLNAME , EMPLFNAME
FROM THETABLE
WHERE EMPLOEEID IN (SELECT DISTINCT EMPSUPERVISOR
FROM THETABLE
)
;