Home > Database > Mysql Tutorial > body text

Oracle update和order by

WBOY
Release: 2016-06-07 15:21:14
Original
1789 people have browsed it

今天遇到一个关于SQL转换成Oracle语句的问题,描述如下: select * from emp order by deptno; select * from dept; Sql Serve

今天遇到一个关于SQL转换成Oracle语句的问题,,描述如下:

select * from emp order by deptno;

Oracle update和order by

select * from dept;

Oracle update和order by

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

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

本文永久更新链接地址

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!