1.现在客户有这样一个需求,查询每个部门工资最高的雇员的信息。
select e.ename, e.job, e.sal, e.deptno from scott.emp e, (select e.deptno, max(e.sal) sal from scott.emp e group by e.deptno) me where e.deptno = me.deptno and e.sal = me.sal;
2.查找某个表 lampa 按字段evno分组,求字段inte的最大值
select * from lampa a where 1>(select count(*) from lampa where a.evno=evno and a.inte<inte)