select lunch_date
from l_lunches
where employee_id = (select employee_id
from l_employees
where hire_date < #1/1/2000#;)
收到一个错误声明,说明这个子查询有什么问题?
预先感谢您
select lunch_date
from l_lunches
where employee_id = (select employee_id
from l_employees
where hire_date < #1/1/2000#;)
收到一个错误声明,说明这个子查询有什么问题?
预先感谢您
尝试:
select lunch_date
from l_lunches
where employee_id IN (select employee_id
from l_employees
where hire_date < #1/1/2000#;)
谢谢@sean bartram,这是问题所在 – Clay
“最多一个记录可以通过这个子查询返回”查询的这个部分应该返回最多只有一个值,它的工作。
select employee_id
from l_employees
where hire_date < #1/1/2000
你能后的问题说明,或者尝试使用交叉应用等
谢谢第一个人帮助我感谢你和你的时间。 – Clay
你的子查询必须返回一个以上的记录,你可以尝试,如果你想要那个HIREDATE后,列出所有员工内部联接
select lunch_date
from l_lunches
inner join l_employees on l_lunches.employee_id = l_employees.employee_id
where l_employees.hire_date < #1/1/2000#
谢谢第一个答案对我有用,但我很感谢你的时间。我可以看到你的位置也有意义。 – Clay
你的子查询(从l_employees SELECT雇员,其中HIRE_DATE < #1/1/2000#; )正在返回多个记录。考虑使用JOIN语句。 – dbardelas
如果您的子查询返回的值不止一个值,您应该使用'IN'而不是'='。 –