如何将其他列和其他表中的值添加到此相关的子查询中?
如何将另一个表中的工人姓名和部门名称列包含到下面的相关子查询中?该表应显示工作不为空的工人的工人 ID 和姓名。
表工作者: 列:名称 施密茨 沃尔夫冈
表:部门 列:部门名称 辅导 诊断
表工作: 科尔:工作 项目负责人 组长 无效的 项目负责人
下面的相关子查询来自表“Work”。
select worker_id from work AS a
where not work is null and exists
(select *
from work as b
where a.worker_id = b.worker_id
and a.work != b.work
)
我尝试过嵌套子查询,但仍然不起作用。
How can I include worker name and department name column from the other table into the correlated subquery below? The table should show the worker id and names from workers whose work is not null.
Table Worker:
col:name
Schmitz
Wolfgang
Table: Department
col: dept_name
Counselling
Diagnosis
Table Work:
col:work
project leader
group leader
null
project leader
The correlated subquery below is from the table 'Work'.
select worker_id from work AS a
where not work is null and exists
(select *
from work as b
where a.worker_id = b.worker_id
and a.work != b.work
)
I have tried with nested subqueries and still does not work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论