本文介绍了支付所有费用的学生的费用总额的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请我帮忙收取学生的费用总额并将其与指定的费用进行比较,
i知道有smg缺失但是如何只选择SUM(FsPaid.Amount)AS totalfees并比较它with Fs1.amount
please i want help to sum amount of fees for students and compare it with assigned one,
i know there is smg missing but how to select only SUM(FsPaid.Amount) AS totalfees and compare it with Fs1.amount
SELECT
SUM(FsPaid.Amount) AS totalfees
FROM FsPrepaidFees FsPre INNER JOIN
Students S ON FsPre.STCode = S.STCode INNER JOIN
FsFeesClass Fs ON Fs.FNCLCode = FsPre.FNCLCode AND Fs.ClassFeesCode = FsPre.ClassFeesCode INNER JOIN
FsFees FsType ON FsType Fs.FNCLCode = FsType.FNCLCode AND Fs.feesCode = FsType.feesCode INNER JOIN
FsPaidFees FsPaid ON FsPre.FNCLCode = FsPaid.FNCLCode AND FsPre.prepaidCode = FsPaid.prepaidFeesCode INNER JOIN
Schools ON S.SCCode = Schools.SCCode AND S.STShift = Schools.SCShift INNER JOIN
EducationLevels INNER JOIN
Classes ON EducationLevels.EDCatCode = Classes.EDCatCode AND EducationLevels.EDLVLCode = Classes.EDLVLCode INNER JOIN
EducationCategories ON EducationLevels.EDCatCode = EducationCategories.EDCatCode ON S.CLSCode = Classes.CLSCode
WHERE
(dbo.S.sccode = 3)
AND (FsType.FNCLCode = 2) AND (FsType.feesType = 0) AND (FsPaid.flgPaid = 1) AND (FsPre.SCYear = 7) and
(select Fs1.amount from FsFeesClass Fs1
group by Fs1.amount
having Fs1.amount = SUM(FsPaid.Amount))
推荐答案
INNER JOIN
EducationLevels INNER JOIN
Classes ON EducationLevels.EDCatCode = Classes.EDCatCode
这篇关于支付所有费用的学生的费用总额的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!