Implementation of Oracle row result total

Time:2021-2-26

The implementation of Oracle row result total is mainly applied to the collection of date results. The following is the specific implementation code.

With AA as (

  select ‘A’ tNo ,  10 B from dual

  union

  select ‘B’ ,  20 from dual

  union
  select ‘A’ ,  30 from dual

)

select tNo , sum(B) over (partition by B order by B rows unbounded preceding) sumsal from AA

 

remarks

You can also write rows 2 preceding, that is, count to the fifth line.

Recommended Today

Practice analysis of rust built-in trait: partialeq and EQ

Abstract:Rust uses traits in many places, from simple operator overloading to subtle features like send and sync. This article is shared from Huawei cloud community《Analysis of rust built-in trait: partialeq and EQ》Author: debugzhang Rust uses traits in many places, from simple operator overloading to subtle features like send and sync. Some traits can be automatically […]