日期:2014-05-16 浏览次数:20574 次
select nvl(acc.A, 0) + sum(tf.A) over(partition by tf.pk1, tf.pk2, tf.pk3 order by tf.C)
  from t_temp_flow tf
 inner join t_temp_acccount ta 
         on tf.pk1 = ta.pk1  and tf.pk2 = ta.pk2 and tf.pk3 = ta.pk3
  left join (select * from t_account where corp = :1) acc 
         on pf.pk1 = acc.pk1 and pf.pk2 = acc.pk2 and pf.pk3 = acc.pk3select nvl(acc.A, 0) + sum(tf.A) over(partition by tf.pk1, tf.pk2, tf.pk3 order by tf.C)
  from t_temp_flow tf,
       t_temp_acccount ta,
       (select * from t_account where corp = :1) acc
 where tf.pk1 = ta.pk1
   and tf.pk2 = ta.pk2
   and tf.pk3 = ta.pk3
   and ta.pk = acc.pk(+)