Home > database >  In the case of oracle if I need two conditions must be met and but is not how to write with
In the case of oracle if I need two conditions must be met and but is not how to write with

Time:09-27

CodePudding user response:

The original poster can say that this is doing?

CodePudding user response:

SELECT ROUND (AVG (f.R STF_PERCENT), 0) AS pmzj_bsp_DISCOUNT, ROUND (AVG (f.R STF_PERCENT), 0) AS aYzj_bsp_DISCOUNT, ROUND (AVG (f.R STF_PERCENT), 0) AS pmzj_b2b_DISCOUNT,
ROUND (AVG (f.R STF_PERCENT), 0) AS aYzj_b2b_DISCOUNT, ROUND (AVG (f.R STF_PERCENT), 0) AS pmzj_b2c_DISCOUNT, ROUND (AVG (f.R STF_PERCENT), 0) AS aYzj_b2c_DISCOUNT
INTO v_pmzj_bsp_percent v_aYzj_bsp_amt, v_pmzj_b2b_percent v_aYzj_b2b_amt, v_pmzj_b2c_percent, v_aYzj_b2c_amt
The FROM AIRFARE. MV_FAREBYRULE_REPORT_DATA f
WHERE f.o ri_code=ALLROUTE. ORI_CODE
AND f.d est_code=ALLROUTE. Dest_Code
And instr (f.b ooking_class, ALLBERTH BOOKING_CLASS) & gt; 0


- BSP par lapse rate
CASE

The WHEN f.R stf_Caculate_Type=0 AND f.b spgroup IS NOT NULL
THEN the AND f.R stf_Caculate_Type=0
AND f.b spgroup IS NOT NULL

Pressing Y - BSP lapse
The WHEN f.R stf_Caculate_Type=4 AND f.b spgroup IS NOT NULL
THEN the AND f.R stf_Caculate_Type=4
AND f.b spgroup IS NOT NULL

The ELSE END;

Is the condition of different take different when

CodePudding user response:

The key is: THEN behind AND how to have??

CodePudding user response:

Remove the AND is not

CodePudding user response:

- this is the syntax

CASE
1 THEN the WHEN condition value 1
2 THEN the WHEN condition value 2
The ELSE value 3
END AS new column name


CodePudding user response:


Or compile error, don't know what's the problem

CodePudding user response:

The CASE WHEN THEN can only return value,

CodePudding user response:

You're going to be like this?
 case when A=0 and B is not null then 0 
When A=4 and B is not null then 4
End as type1
  • Related