SELECT p.class , SUM(s.total) as total , SUM(s.remaining) as remaining , SUM(p.ammount) as ammountFROM Students as sINNER JOIN payments as p ON p.class = s.classGROUP BY p.class
Hey sami, did u try my suggestion ? It will give you the same output.
Ryan Chong
@Pawan,
I think based on your statement above, it may return different (multiply effect) results if there are multiple payments based on the joining conditions.