SELECT ex.`ID`, ex.`ExpenseName`, om.`Taka`, SUM( om.`Taka` ) AS 'Total Taka' FROM (office_expense_main om) JOIN (office_expenses ex) ON (ex.ID=om.OfficeExpenseID) JOIN (yyyy_mm_officeexpense ym) ON ( ym.Year_Month = '" + _yearMonth + "' AND om.YearMonthID <= ym.ID ) GROUP BY om.`OfficeExpenseID`
This query should show [om.
Taka] of given [ym.Year_Month] and sum[om.
Taka] - that the sum of all previous Taka till the given Year_Month. Group By om.ID
Now, it showing 'Taka' of the first Year_Month (eg. if i want to see 'taka' of march and sum('Taka') till march, it's showing me 'Taka' of january (the first entry in yyyy_mm table) NOT for march. but showing the sum('Taka') exactly what i want to see) not the one I provided. but sum(Taka) till the given YearMonth.!
But it shows exactly same result before yesterday! but I didnt change anything in this and i am not getting why its showing different NOW..
Can anybody help me!