outer join with multiple fields

G

Guest

I am trying to join two tables that link on 4 fields. Table one will contain
records with no match to the combined linking fields in table 2, thus I want
all records in table 1 and all matching records from table 2. The output
includes an aggregate (sum) field from both tables. Using LEFT OUTER JOIN to
define each of the four joins hasn't worked.

DM
 
M

Marshall Barton

Dick said:
I am trying to join two tables that link on 4 fields. Table one will contain
records with no match to the combined linking fields in table 2, thus I want
all records in table 1 and all matching records from table 2. The output
includes an aggregate (sum) field from both tables. Using LEFT OUTER JOIN to
define each of the four joins hasn't worked.


A LEFT JOIN sounds like the right thing to do, but without
seeing your SQL statement, I can't say if you've got it
right or not.

If you do have the correct join, then maybe your problem
definition is insufficient to come up with the proper query.
If you'll provide more details about the tables, their
dields and how they relate along with a more specific
statement of the goal, maybe someone will be able to sort it
out.
 
G

Guest

Here is the detail:

Two tables with identical structures: Table 1: Forecast (acctno, dept, div,
month, amt); Table 2: Budget, same structure, same unique index. Table one
will contain acctno enties not present in Table 2. My query output will call
for a summary of the amt fields from both tables. The query may group on any
one or more of the other fields. The tables must link on the first four
fields. The problem: constructing a query that will include all of the
records in Table 1 and Table 2.

DM
 
G

Guest

Never mind folks; problem solved.

Marshall Barton said:
A LEFT JOIN sounds like the right thing to do, but without
seeing your SQL statement, I can't say if you've got it
right or not.

If you do have the correct join, then maybe your problem
definition is insufficient to come up with the proper query.
If you'll provide more details about the tables, their
dields and how they relate along with a more specific
statement of the goal, maybe someone will be able to sort it
out.
 

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