sql - How to find regions where total of their sale exceeded 60% -


i have table interest_summary table 2 columns:

  • int_rate number,
  • total_balance number

example

10.25  50 10.50 100 10.75 240 11.00  20 

my query should return in 2 columns or string 10.50 10.75 because adding total exceed 60% of total amount added together

could suggest logic in oracle?

select    min(int_rate),    max(int_rate)     (     select        int_rate,          nvl(sum(total_balance) over(         order total_balance desc         rows between unbounded preceding , 1 preceding       ),0) part_sum     interest_summary   )    part_sum < (select 0.6*sum(total_balance) interest_summary) 

fiddle


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -