How To Combine 2 Different Table?
how to combine 2 different tables where they contain the same fields but different data, example Cash_Expenses { exp_date exp_cat_id exp_amount exp_remark } Cheque_Espenses { exp_
Solution 1:
This should get you close:
select cat_name, sum(exp.exp_amount)
from (select exp_cat_id, exp_amount from cash_expenses
unionallselect exp_cat_id, exp_amount from cheque_expenses) as exp
innerjoin exp_cat on exp.cat_id = exp_cat.cat_id
groupby cat_name;
Solution 2:
Try a UNION query:
SELECT*FROM Cash_Expenses
UNIONSELECT*FROM Cheque_Expenses;
Post a Comment for "How To Combine 2 Different Table?"