我想在内部连接上使用子查询从部门中没有程序员的表中取回所有部门编号和名称,但是由于它返回时遇到了一些麻烦没有价值。这是我的代码,谢谢你的帮助。SQL内部连接和子查询
select Departments.Department_Name, Departments.Department_No
from employees inner join departments
on departments.department_No = employees.Department_No
where Employees.Department_No !=
(select Department_Name
from Employees, Departments
where Job_ID = '%pro%')
您department_name'比较''到department_no'。这看起来不正确。 – 2014-09-29 11:55:31
你能提供一个表/结果的例子吗? – 2014-09-29 11:56:06
您的子查询正在使用'Employees,Departments'而没有加入 - 这看起来不正确。你应该用你的表格结构,样本数据和期望的结果来编辑你的问题。 – Taryn 2014-09-29 11:56:52