有员工信息表emp1(包含以下字段empno-工号,name-姓名,deptno-部门,salary-工资,sex-性别(0代表男性,1代表女性)
请列出所有工资少于同部门男性员工平均工资的女性员工的工号,姓名和部门。
select empno,name,deptno
from emp1 x
where sex = '1' and ( )
在括号中填上适当的语句。
请列出所有工资少于同部门男性员工平均工资的女性员工的工号,姓名和部门。
select empno,name,deptno
from emp1 x
where sex = '1' and ( )
在括号中填上适当的语句。
解决方案 »
- 求救 SQL Server 错误 '80040e21' 超时已过期 错误行Rs.open SQL,Conn,1,1
- 请教一天SQL查询语句
- 求一条提高效率的SQL语句
- 如何在SQL Server中跨服务器访问数据库?
- sqlserver进行大量数据操作,连接池满的问题怎么解决?
- 如何统计分组里每个组的个数,请老师帮一下忙
- 怎样调用一个存储过程中的结果集合
- 人员编码重新分配后,引起的统计报表问题
- 区别在哪里?
- XXXXXXXXXXXXXXXXXXX为什么我的SQL server(正版)可以启动,但SQL server Agent不能启动呢?
- 谁有DBCC一系列命令的教程
- 2000里,存储过程调试问题
salary<(select avg(salary) from emp1 where sex = '0' and deptno=x.deptno)
salary<(select avg(salary) from emp1 where sex = '0' and deptno=x.deptno)
salary<(select avg(salary) from emp1 where sex = '0' and deptno=x.deptno)
salary<(select avg(salary) from emp1 where sex = '0' and deptno=x.deptno)
from emp1
where sex = '0')
salary<(select avg(salary) from emp1 where sex = '0' and deptno=x.deptno)
SQL code
salary<(select avg(salary) from emp1 where sex = '0' and deptno=x.deptno)
[/Quote]不要加 group by deptno 用子查询就可以实现要求