当前位置: 代码迷 >> Sql Server >> 子查询返回值多于一个的有关问题。
  详细解决方案

子查询返回值多于一个的有关问题。

热度:84   发布时间:2016-04-24 21:58:33.0
子查询返回值多于一个的问题。。。
查找财务部年龄低于开发部员工年龄的员工的姓名。

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
查找财务部年龄低于开发部员工平均年龄的员工的姓名。
查找财务部年龄低于开发部员工最高年龄的员工的姓名。
查找财务部年龄低于开发部员工最低年龄的员工的姓名。
  相关解决方案