当前位置:Gxlcms > 数据库问题 > Oracle update和order by

Oracle update和order by

时间:2021-07-01 10:21:17 帮助过:14人阅读

技术分享

select * from dept;

技术分享

Sql Server:

update dept a set dname=(select top 1 ename from emp where deptno=a.deptno order by sal)

经过尝试,查找资料,得出下面转换结果,不知道这样是否可行:

update dept a set dname=

(with t as(select ename,deptno from emp order by sal)

select ename from t where deptno=a.deptno and rownum=1)

where exists(with t as(select ename,deptno from emp order by sal)

select null from t where deptno=a.deptno)

执行结果:

select * from dept;

技术分享

其他替代方法随后再做尝试。

Oracle update和order by

标签:

人气教程排行