sqlserver中有update set from where用法,oracle中没有这种用法
可以使用如下办法实现
update tbA a
set a.colA=(select b.colB from tbB b where a.colC=b.colC)
where exists (select 1 from tbA a,tbB b where a.colC=b.colC)
删除多余行
delete from tb a where exists(select 1 from tb b where a.name=b.name and a.aaa >b.aaa)
字段名 name aaaa
aa 1
aa 2
bb 1
bb 2
cc 1
dd 2
期望的结果是
字段名 name aaaa
aa 1(2也可以)
bb 1(2也可以)
cc 1
dd 2
本文介绍了如何在Oracle数据库中使用SQL语句实现类似SQL Server中update set from where的功能,并提供了具体的示例代码。同时,还展示了如何通过SQL语句进行数据行的删除操作。
17万+

被折叠的 条评论
为什么被折叠?



