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怎么对应的?
这是什么意思..
上面写的语句里,加上rownum=1就是当出现多条记录时取第一条。否则会出现错误
rownum=1是取同一个bianhao下的一条mingcheng记录。在testcc中你同样的bianhao,应该也对应同样的mingcheng。。
你执行下列查询看看
select a.*,b.mingcheng
from testaa a,testcc b
where a.id1=b.bianhao(+)