oracle - Joining two case statements -
I would like to check that it is possible to combine the two statements together? I have tried to do something like this, but I am getting the 'Consumption bill illegal identifier' error. I know I get this error as I do not have a ConsumptionBill feature.
So it is still possible to get involved in two case statements?
Select CustName, preRead, newRead, new read-prearride at content consensus, case when prompt - sent date & gt; 30 THEN Consumption + FP when SYSDATE - Sent & gt; 45 THEN Consumption + AP ELSE ExpenditureBill + 0 from the BIll as Selection (Select C.firstName || '' .lastname as CostName, R.Newering PURED, Lead (RNU) Readings) over (R. electrascimetide ord by part arbitrage) as new read, BFS, FR as BSXRAT SR, TR as BHDRCTR, P. FastPanMT as FP, P As a SCPANAM SP, Blow .tent date, case new read-premiere = 20 then (newRead-preRead) * FR when newRead-preRead & lt; = 30 then 20 * FR (newRead-preRead -100) * SR when newRead-preRead & Gt; 40 then 20 * FR + 30 * SR + ((newRead- previousRead) -50) * TR reading r, svcaddress s, electricmeter w, customer c, rate a, nonresrate b, penRate p, bill from bill As the end of consumption, where W.electricmeterID = S.electricmeterID and R.electricmeterID = W.electricmeterID and Aetrad = SRTID and BRTID = Erratrad and C.customerID = S.customerID and C.customerID = bl.customerID and R.readingID = bl.readingID and P.preRateID = C.preRateID and C.customerType = 'nonr Esidential 'and r.datevisited & gt; = TO_DATE ('01 -05-2013 ',' DD-MM-YYYY ') and RDTivate and Lieutenant; TO_DATE ('31 -08-2013 ',' DD-MM-YYYY ')) where the new read is not empty;
It is difficult to tell without reference to what you are doing.
However, you probably want a subtitle
selectwhen SYSDATE - sentDate> 30 Consumption Bills + FP; When SYSDATE - Sent & gt; 45 then consumption bill + SP ELSE consumption + 0 EDD as total bond (Select FP, sent, SP, case when new read-prepper read <100 = THEN (new read-preoperated) * FR when new read-EDR Reid & lt; = 200 THEN 100 * FR (newRead-previousRead-100) * SR when newRead-previousRead> 200 then 100 * FR + 100 * SR + ((newRead-previousRead) -200) My_table from ConsumptionBill In the form of TR * end * T
Here, we also include an intermediate record
T that the computed field
Consumpti OnBill
We want to use later.(I call "intermediate", but only perceptual ... whether or not the query planner can set intermediate records - maybe this will not happen.)
Comments
Post a Comment