Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to used Sum inside the case statemnet

Sandy310Apr 2 2010 — edited Apr 2 2010
Hi,

I am supposed to use following statement in query. As per my understanding Sum can not be used inside case statement.
How do I acheive same result.
 
sum(case when sum(a.points) is null then a.transactionamount else sum(a.points) end), 
 
SELECT a.postdateid transaction_date, 
  SUM(a.points) POINTS_OR_MILES_CREDITED, 
  sum(case when sum(a.points) is null then a.transactionamount else sum(a.points) end), 
  FROM accrual a 
join MemberALL m on m.memberid = a.memberid 
WHERE a.awardnumber IS NULL 
GROUP BY a.postdateid 
ORDER BY a.postdateid; 


Thanks 
Sandy 
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 30 2010
Added on Apr 2 2010
1 comment
15,083 views