i face ORA-00937: not a single-group group function 00937. 00000 - "not a single-group group function" error problem in this sql query
select c.First_Name,sum(r.installment_number)
from LMS_CUSTOMER_M c, LMS_REPAYSCH_DTL r,LMS_AGREEMENT_DTL a
where (c.Customer_ID=a.Lessee_ID and a.agreement_id= r.agreement_id)
and a.Loan_Disbursal_Date < r.Installment_Due_Date;
You need to add group by
clause as you are using sum()
aggregation with a column
select c.First_Name,sum(r.installment_number)
from LMS_CUSTOMER_M c join LMS_AGREEMENT_DTL a on c.Customer_ID=a.Lessee_ID
join LMS_REPAYSCH_DTL r on a.agreement_id= r.agreement_id
where a.Loan_Disbursal_Date < r.Installment_Due_Date
group by c.First_Name
if you use an aggregation function (sum in you query) you must use a GROUP BY.
select c.First_Name,sum(r.installment_number)
from LMS_CUSTOMER_M c, LMS_REPAYSCH_DTL r,LMS_AGREEMENT_DTL a
where (c.Customer_ID=a.Lessee_ID and a.agreement_id= r.agreement_id)
and a.Loan_Disbursal_Date < r.Installment_Due_Date
GROUP BY c.First_Name;
You cannot use sum without aggregating functions group by:
select c.First_Name,sum(r.installment_number)
from LMS_CUSTOMER_M c, LMS_REPAYSCH_DTL r,LMS_AGREEMENT_DTL a
where (c.Customer_ID=a.Lessee_ID and a.agreement_id= r.agreement_id)
and a.Loan_Disbursal_Date < r.Installment_Due_Date
GROUP BY c.First_Name;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.