sql - MS Access sum of 2 table in one query -
i have 2 tables:
- name "mfr"
- name "pomfr"
both have many columns, same, , want sum of similar column in 1 query based on 1 of them similar column group by
data sample
table1. mfr rfno|ppic|pcrt 101 | 10| .30 102 | 15| .50 103 | 18| .68 table2 pomfr rfno|ppic|pcrt 101 |100 | 1.15 102 | 50 | 1.50 103 | 0 | 0
and result in query should
mfrquery rfno|ppic|pcrt 101|110 |1.45 102| 65 |2.00 103| 18 | .68
i'll nice. isn't efficient method, it'll work...
select* #temp table1 union select* table2 select id,sum(ppic) ppic, sum(pcrt) pcrt #temp group id
what says is, select table 1 , use union table 2 , place in temporary table called #temp. filter variables , ranges need.
then 2nd part says, take sum of ppic , sum of pcrt #temp table , group id.
since you're new so, future reference, people aren't mean, want see put forth sort of effort problem, i've gotten several times here. helpful community! best of luck you!
Comments
Post a Comment