i have query this, able data of both tables individually. concept want sum of amount according group month . 1 table can retrieve amount correctly, have sum of amounts both tables combined depending on month.
(select sum(amount) amount , month(reciept_date) month , year(reciept_date) year sg_chool academic_year = '2' group month(reciept_date)) union (select sum(amount_paid) amount , month(reciept_date) month , year(reciept_date) year sg_fees academic_year = '2' group month(reciept_date))
try
select sum(temp.amount) amount, temp.month, temp.year ( (select sum(amount) amount , month(reciept_date) month , year(reciept_date) year sg_chool academic_year = '2' group month(reciept_date)) union (select sum(amount_paid) amount , month(reciept_date) month , year(reciept_date) year sg_fees academic_year = '2' group month(reciept_date)) ) temp group temp.month;
Comments
Post a Comment