i have a query is to lookup CREDIT_CARD table using CREDIT_CARD_ID and get the MIN_REPAY_AMT. if SUM(AMOUNT_DEPOSITED) < MIN_REPAY_AMT for that month Then populate 1000 else 0 i have attempted the query below kindly help me out

and i am getting the following error.
Error:

ERROR at line 2:
ORA-00923: FROM keyword not found where expected

Code:

select a.CREDIT_CARD_ID,a.MIN_REPAY_AMT,to_char(DATE_OF_TRANS,'month') 
case when
a.CREDIT_CARD_ID = b.CREDIT_CARD_ID
then
case when
sum(CREDIT_CARD_DEPOSIT.AMOUNT_DEPOSITED)< a.MIN_REPAY_AMT
Then
1000
else
0 
end repay_charges from credit_card a join  CREDIT_CARD_WITHDRAW b on a.CREDIT_CARD_ID = b.CREDIT_CARD_ID;
Member Avatar for hfx642

Well... First of all, you are missing the comma after your date column.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.