0
这里是我的代码...我自己测试了子查询,它起作用。我独自加入了两张桌子,这很有效。当我把它们合并时,我得到一个错误,指令没有正确结束。SQL代码与子查询连接表无法正常运行
select employees.last_name,departments.department_name,departments.location_id, locations.city
FROM hr.employees, hr.departments, hr.locations
where employees.department_id = departments.department_id
AND departments.location_id = locations.location_id
WHERE commission_pct =
(select commission_pct
from hr.employees
where commission_pct IS NOT NULL)
commission_pct是单个值,但子查询返回一组结果。它有助于:'选择top 1 commission_pct'。另外,你可以复制/粘贴错误吗? –
并将'WHERE commission_pct'更改为'AND commission_pct' – GurV
哦,并且您有两个where子句。 –