Sum Unique Values in a Join Query

K

Keith Young

Here is the problem I am trying to figure out:

I am matching two separate tables on two fields (Field1 and Field2). Before
performing the match (or possibly somehow during the match) I need to sum up
all the unique records (based on Field1 and Field2) on each table.

Here is what the data in each of the 2 tables might look like:

Table #1
Field1 Field2 Field3
a x 20
a x 40
a x 40
a y 90
a z 100
b x 50
b x 75
b y 150
b y 26
b z 99

Table #2
Field1 Field2 Field3
a x 11
a x 19
a y 44
a z 3
b x 29
b y 88
b z 68
b z 4

So in effect, the unique records (and corresponding sums) in each table that
would be matched would be as follows:

Table #1
Field1 Field2 Field3
a x 100
a y 90
a z 100
b x 125
b y 176
b z 99

Table #2
Field1 Field2 Field3
a x 30
a y 44
a z 3
b x 29
b y 88
b z 72

and the results from the match would look something like this:

Field1 Field2 Field3-1 Field3-2
a x 100 30
a y 90 44
a z 100 3
b x 125 29
b y 176 88
b z 99 72

Can this be done all in one step?

Thanks in advance. Using Access 2002

Keith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top