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
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)