我在两个表中有一系列员工编号,并且当我比较包含员工编号的列时,我试图在名为HTG_ScheduleRequest的表中找到我的图像表中找不到的值。
我已发出此命令但显示所有值:
SELECT DISTINCT
HTG_ScheduleRequest.AssignedTech
FROM
HTG_ScheduleRequest ,
images
WHERE
HTG_ScheduleRequest.AssignedTech <> images.empno
答案 0 :(得分:2)
你的问题不是100%明确,但这是我的方法:
http://sqlfiddle.com/#!9/a8286ee/1
SELECT DISTINCT sr.AssignedTech
FROM HTG_ScheduleRequest sr
LEFT JOIN images i
ON sr.AssignedTech = i.empno
WHERE i.empno IS NULL
答案 1 :(得分:0)
SELECT DISTINCT A.AssignedTech
FROM
HTG_ScheduleRequest A
WHERE NOT EXISTS (SELECT NULL FROM images B WHERE A.AssignedTech=B.empno);