What you can do in the cases of compound queries is create a view in sql and fetch the data from view.
So you cat create a view like this:
create view V1 as (Select Fees_Transaction.Regno, Fees_Transaction.ST_Name, SUM(Fees_Transaction.Amount_Paid) as Amount_Paid, Fees_Transaction.Class, Fees_Transaction.Section, SUM(FeesMaster.FeeAmount) as FeeAmount FROM Fees_Transaction LEFT OUTER JOIN FeesMaster ON (Fees_Transaction.Regno=FeesMaster.Regno AND and Fees_Transaction.FeeType=FeesMaster.FeeType) GROUP By (Fees_Transaction.Regno, Fees_Transaction.ST_Name, Fees_Transaction.Class, Fees_Transaction.Section))
test the result with a query. say
select * from V1.
It is easy to debug the problems in view rather than debugging them through code. Once your data is shown appropriately, select from view with a condition.