协助查询 [英] Assistance with a Query

查看:81
本文介绍了协助查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好:


我正在尝试整理一个查询,以确定在过去两个月内发生事故的部门中的员工。我有一个查询,确定谁有事件和事件以及他们遇到事件时所在的部门:

Hello:

I am trying to put together a query that determines employees who are in a department that has had an incident with in the last two months. I have a query that determines who has had and incident and the department they were in when they had the incident:

展开 | 选择 | 换行 | 行号

推荐答案

尝试 IN 或不在。


然后,您可以选择所有员工的部门不在发生事故的员工的部门列表中。
Try the IN or NOT IN.

Then you can select all employees whose department is NOT IN the list of departements of employees who have had an incident.
展开 | 选择 | Wrap | 行号


Hi Chip,


我感谢您的回复。我在查询时遇到问题。我的查询没有返回任何内容。这是:
Hi Chip,

I appreciate your response. I am having trouble with this query. My query does not return anything. Here it is:
展开 | 选择 < span class =codeDivider> | Wrap | 行号


您不需要qryCurrentEmpDept.dept = qryRestrictedemployeesWithDepts.dept。

只要确保你的子查询返回有违规行为的员工部门,不要试图将它与qryCurrentEmpDept联系起来,这就是NOT IN的作用。
You don''t need the qryCurrentEmpDept.dept = qryRestrictedemployeesWithDepts.dept.
Just make sure your subquery returns the departments of employees with infractions, don''t try to relate it to qryCurrentEmpDept, that''s what the NOT IN does.


这篇关于协助查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆