这条sql能不能用max()over()改写

[复制链接]
查看11 | 回复0 | 2015-7-16 14:18:24 | 显示全部楼层 |阅读模式
drop table t1;
drop table t2;
create table t1 as select * from scott.emp;
create table t2 as select * from scott.emp;
update t2 set sal=sal+1000;
commit;
--sql
select t1.*,(select max(sal) from t2 where t2.deptno = t1.deptno and t2.sal>2900)asmax
from t1order bymax , empno;
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行