leezac
asked on
Case Statement where one column is null
I have two columns LOAN_CT and LOAN_BAL.
In the below statement I am needing to show '0' in LOAN_NO column row if LOAN_BAL is null else count LOAN_CT.
SUM( case when (Loan_Bal) > 0 then count(LOAN_CT) else 0 end) as "Count of Loans",
In the below statement I am needing to show '0' in LOAN_NO column row if LOAN_BAL is null else count LOAN_CT.
SUM( case when (Loan_Bal) > 0 then count(LOAN_CT) else 0 end) as "Count of Loans",
please post sample data and expected output
I don't understand this - > LOAN_NO column row
what is LOAN_NO? how does it relate to the rest of the sql
what do you mean by "column row" ?
sample data and expected output should help immensely
what is LOAN_NO? how does it relate to the rest of the sql
what do you mean by "column row" ?
sample data and expected output should help immensely
To get a 0 when there is a null use: NVL(some_column,0)
I'm not understanding what you really want here.
I'm not understanding what you really want here.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
case when loan_bal = 0 then 1 else loan_ct end loan_ct
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I agree with all of the solutions presented - thank you.