update TB bThe set b.b=b.b + (select sum (decode (a.a 4, '0', a.a 5, '1', (0 to 5) a.a, 0)) from ta a
Where a.a 1 and 1=b.b a.a 2=2 and 3=b.b a.a b.b 3)
Where b.b 1='4343' and b.b 2 in (select 2 from ta a.a where a a.a 1 and 1=b.b a.a 2=2 and 3=b.b a.a b.b 3)
The SQL so ugly ah, I feel a lot of conditions are repeated, so I wrote the following SQL
merge into TB b
Using (select a.a 1, a.a 2, 3, a.a sum (decode (a.a 4, '0', a.a 5, '1', (0 to 5) a.a, 0) tall from ta a group by 1, a.a a.a 2, and 3) a.a c)
On (b.b 1=1 and 2=2 and Arthur c. b.b Arthur c. b, b3=3 and Arthur c. b.b 1='4343')
The when matched then
Update the set b.b=b.b + c.t all
In the group of great god is there a better update statement, everybody,