日期:2014-05-17  浏览次数:20466 次

子查询返回值多于一个的问题。。。
查找财务部年龄低于开发部员工年龄的员工的姓名。

select name from employees where  birthday in (select birthday from employees where departmentid in (select departmentid from departments where departmentname = '财务部'))
and ((select birthday from employees where departmentid in (select departmentid from departments where departmentname = '财务部'))
 >all  (select birthday from employees where departmentid in (select departmentid from departments where departmentname = '开发部')))

------解决方案--------------------
引用:
查找财务部年龄低于开发部员工年龄的员工的姓名。

问题本身就有BUG
查找财务部年龄低于开发部员工平均年龄的员工的姓名。
查找财务部年龄低于开发部员工最高年龄的员工的姓名。
查找财务部年龄低于开发部员工最低年龄的员工的姓名。