update testaa
set name1=(select mingcheng from testcc where rownum=1 and bianhao=testaa.id1)
where exists(select 1 from testcc where bianhao=testaa.id1);(wildwave回答)为什么批量更新时rownum找出的是我想要的数据?
select mingcheng from testcc where bianhao=testaa.id1 出现几条数据 rownum怎么对应的?
set name1=(select mingcheng from testcc where rownum=1 and bianhao=testaa.id1)
where exists(select 1 from testcc where bianhao=testaa.id1);(wildwave回答)为什么批量更新时rownum找出的是我想要的数据?
select mingcheng from testcc where bianhao=testaa.id1 出现几条数据 rownum怎么对应的?
解决方案 »
- oracle数据库服务器加入域后,客户端连不上???
- 多表导入自身数据问题
- ORA-01424:转义字符之后字符缺失或非法
- 如何使用sqlloader导入xml文件到Oracle数据库?
- 谁能帮忙优化一下这个sql查询语句,谢谢!
- 在插有网线的情况下怎么样链接Oracle数据库??
- 想使用trigger变换日期格式后再插入
- 求满足我要求的标准SQL语句,超难,多帮忙,我头都大了还是没搞好!~!~!~!~!~!~!~!~!~!~
- 如何运行oracle script?
- select to_date('22-FEB-98','DD-MON-YY') from dual;为什么不正确
- 如何获得oracle中某个数据表的schema呢
- oracle的sql语句为什么要在表名前加前缀?
这是什么意思..
上面写的语句里,加上rownum=1就是当出现多条记录时取第一条。否则会出现错误
rownum=1是取同一个bianhao下的一条mingcheng记录。在testcc中你同样的bianhao,应该也对应同样的mingcheng。。
你执行下列查询看看
select a.*,b.mingcheng
from testaa a,testcc b
where a.id1=b.bianhao(+)