C clyin Unregistered / Unconfirmed GUEST, unregistred user! 2002-04-27 #1 有一个表T字段如下 部门名称, 员工姓名, 年龄, 学历,工资 我想用一条SQL语句,列出各个部门工资最高的员工的所有信息,该怎么写?
X xianjun Unregistered / Unconfirmed GUEST, unregistred user! 2002-04-27 #2 select * from T where T.工资 = (select max(工资) from T);
D deyan Unregistered / Unconfirmed GUEST, unregistred user! 2002-04-27 #3 select * from emp e1 where not exists( select empno from emp e2 where e2.sal>e1.sal and e2.deptno=e1.deptno) order by deptno
select * from emp e1 where not exists( select empno from emp e2 where e2.sal>e1.sal and e2.deptno=e1.deptno) order by deptno
Z zuidaeji Unregistered / Unconfirmed GUEST, unregistred user! 2002-04-27 #4 sql server下用select * from T where T.工资 = (select max(工资) from T);
U ugvanxk Unregistered / Unconfirmed GUEST, unregistred user! 2002-04-27 #5 select 部门名称, 员工姓名, 年龄, 学历,工资 from t where t.员工姓名 In (select 部门名称, 员工姓名,max(工资)from t group by 部门名称, 员工姓名 )
select 部门名称, 员工姓名, 年龄, 学历,工资 from t where t.员工姓名 In (select 部门名称, 员工姓名,max(工资)from t group by 部门名称, 员工姓名 )
弟 弟子 Unregistered / Unconfirmed GUEST, unregistred user! 2002-04-27 #6 select * from T where 工资 = (select max(工资) from T)
沉 沉香屑 Unregistered / Unconfirmed GUEST, unregistred user! 2002-04-27 #7 select * from emp e1 where not exists( select empno from emp e2 where e2.工资>e1.工资 and e2.部门=e1.部门) order by 部门
select * from emp e1 where not exists( select empno from emp e2 where e2.工资>e1.工资 and e2.部门=e1.部门) order by 部门