日期:2014-05-17 浏览次数:21016 次
--试下这个看能否达到你的效果 update temp_a1 a set a3=(select b2 from temp_b1 b where a.a2=b.a2 and rownum=1 and length(b2)=(select max(length(b2)) from temp_b1 bx where b.a2=bx.a2) );
------解决方案--------------------
UPDATE temp_a1 a SET a.a3=(SELECT b2
(select c.*,row_number() over(partition by c.a2 order by length(c.b2) desc) rn
FROM temp_b1 c
)b WHERE b.a2=a.a2 AND b.rn=1 )
------解决方案--------------------
取b2的的最长的那个值,这个和你的排序是没有影响的,可以直接用max 在b2中取值即可:
update temp_a1 a
set a.a3 =
(select max(b.b2) b2
from temp_b1 b
where b.b2 = a.a2)