oracle - Re-use a calculated field value in the same row - SQL -


What I'm trying to do is writing a query that gives the following output:

output of query

The value of the day for an account number is a calculated field, Which calculates the information with that number is currently in DB, then for day +1, I need to start calculating with the value of the day. But how can I pass this value so that I can use it in 1 +1 for my calculations? how can I do this? They do not like PL SLL at my workplace, so this is the worst condition.

To get information for all 16 accounts for the current one I wrote the query:

  OBforeachaccount.accountnumber selection accountnumbers, (OBforeachaccount.ob - NVL (IDforeachaccount.sumamounts, 0) - NVL (paymentsforeachaccount.sumpayments, 0)) Day1, Day1 + 5 --ophalen van CB day -1 (ACCOUNT_ID AccountNumber, cal_date, fillinggaps g to cb_amount_default OB, dim_date d select day2 Where g.balance_date = d.cal_date and d.cal_date = TO_CHAR (sysdate-1, 'DD / MM / YYYY') ACCOUNT_ID, cal_date) Order by OBforeachaccount, (a.id AccountNumber, cal_date, select yoga) (AMOUNT_USD) sum_message_in_f_act_id_transaction I, dim_dat The e d filter is based on the account number group, where i.value_date_id = d.id and i.account_id = a.id and d.cal_date = TO_CHAR (sysdate -1, 'DD / MM / YYYY') --future one Dim_account by A.id, cal_date order by a.id, cal_date) idfarch account, (ordering_account_id accountnumber, select cal_date), sum (instructed_amount_default) fact_payment p, dim_date d sumpayments where p.value_date_id = d.id and d.cal_date = TO_CHAR (sysdate-1, 'DD / MM / YYYY') by group ordering_account_id, cal_date order by ordering_account_id, cal_date) paymentsforeachaccount where OBforeachaccount.accountnumber = IDforeachaccount.accountnumber (+) and OBforeachaccount.accountnumber = paymentsforeachaccount.accountnumber (+)   

Thanks for your advice people

I get an account number and a value of the day I suggest using an inline view for, and then only references a value in a query that is required in additional columns.

In a pseudo query:

  select account_number, day 1, day 1 + day 2 day, day 1 + y day 3 (select account_number, intensive_calculation day1 Something from the table where something = something);  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -