I have two tables with same field types. Fields that are common in here are *BG_ID* and Store Number. Now I want to SUM two columns (*total_area* and *total_area_blk*) from two tables and group them by BG_ID .
The following is what I tried which doesnt work:
select t.bg_id, t.store_number,sum(a.total_area),sum(b.total_area_blk)
from (select bg_id,store_number,total_area
from temp_Prop_area_block a
where store_number='33665'
union all
select bg_id,store_number,total_area_blk
from temp_Prop_area_BG b
where store_number='33665')