Absolutely and here is the SQL. I will assume you meant the customer number to be 1289 PHP in the SANCTION table in order to get the desired output.
SELECT t1.customer_NO "Customer No.", t1.Customer_name " Customer Name", t1.CUSTOMER_ADDRESS "Customer Address", t1.Share_holding "Shares", t2.loan_sanctioned "Amt.Santioned", sUM(t3.loan_advanced) " Amt. Advanced", COUNT(t3.loan_no) "Advanced INst", t2.loan_purpose "Purpose", (case when SUM(t3.loan_advanced) < t2.loan_sanctioned then '*****' else '' end) "Remarks" FROM CUSTOMER T1, LOAN t2, ADVANCEMENT t3 WHERE T1.CUSTOMER_NO = T2.CUSTOMER_NO AND T2.LOAN_NO = T3.LOAN_NO GROUP BY t1.CUSTOMER_NO, CUSTOMER_NAME, CUSTOMER_ADDRESS, SHARE_holding, LOAN_SANCTIONED, LOAN_PURPOSE /
Dig Deeper on Using Oracle PL-SQL
Related Q&A from Azim Fahmi
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.