Home > database > Oracle: how to use SQL to capture the results come out
Oracle: how to use SQL to capture the results come out
Time:09-24
Complete data on the left, only the first on the right data, the need to generate the data, you can write in SQL?
CodePudding user response:
You find out what data relationship
CodePudding user response:
The source data look like? What are the rules? The result is what?
All said once
CodePudding user response:
Like this?
with t1 as ( Select id 1, null c1 and c2 from 18.97/100 dual Union all Select 2 id, 0.04/100 c1, null from dual Union all Select 3 id, 0.02/100 c1, null from dual Union all Select 4 id, 0.02/100 c1, null from dual Union all Select 5 id, 0.02/100 - c1, null from dual Union all Select 6 id, 0.02/100 c1, null from dual ) Select id, c1 and c2 That case the when id=1 then c2 else (exp (sum (ln ((1 + NVL (c1, 0)) * (1 + NVL (c2, 0)))) over (order by id))) - 1 end The from t1
CodePudding user response:
Complement to describe, so to understand, and now have A Temp table, data screenshot below, the left column column A is assumed, listed on the right side of the B column, A column data is complete, B column data is only an initial value, Now want to put the rest of B value calculation formula for Posting post screenshots