A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Joining 3 tables in a query



 
 
Thread Tools Display Modes
  #1  
Old March 17th, 2005, 05:27 PM
Chrismja
external usenet poster
 
Posts: n/a
Default Joining 3 tables in a query

I am joining 3 tablesin a query, but it's only pulling matching records in
the tables, and there are some unique records I also need it to pull. I'm
sure there is a way to do this, but I don't know how. Here's the situation:
I have a table named "Total Inventory" and I have 2 other tables that
include incentives for 2004 models and 2005 models. I have a query that that
has these 3 tables joined via joining "2004 incentives.body code" to "Total
Inventory.Model Code" (which are the same thing), then on the other side I
also have 2005 incentives table joined to "Total Inventory" via "2005
Incentives.body code" to "Total Inventory.Model Code" . My problem is this:
The query pulls all the records from inventory that has a matching model
code to the "body codes" in the 2 incentive tables with the exception of
"body codes" that are only listed in either the 2004 or 2005 incetive
tables. In other words the "body code" must be listed in both 2004 and 2005
Incentive tables in order for the query to pull the matching records.
However there are some "body codes" that are only found in either the 2004
or in the 2005 incentive table. How can I make this query pull all of the
records that have a match in "Total Inventory" if they don't have a match in
the other incentive table? I have already tried changing the relationships
to left join or right join, but both of these give me an error that says:
the SQL statement could not be executed because it contains ambiguous outer
joins. Does anyone have any suggestions?


  #2  
Old March 17th, 2005, 07:31 PM
[MVP] S.Clark
external usenet poster
 
Posts: n/a
Default

Post the table structures for each table.

--
Steve Clark, Access MVP
FMS, Inc.
www.fmsinc.com/consulting

"Chrismja" wrote in message
...
I am joining 3 tablesin a query, but it's only pulling matching records in
the tables, and there are some unique records I also need it to pull. I'm
sure there is a way to do this, but I don't know how. Here's the situation:
I have a table named "Total Inventory" and I have 2 other tables that
include incentives for 2004 models and 2005 models. I have a query that
that has these 3 tables joined via joining "2004 incentives.body code" to
"Total Inventory.Model Code" (which are the same thing), then on the other
side I also have 2005 incentives table joined to "Total Inventory" via
"2005 Incentives.body code" to "Total Inventory.Model Code" . My problem is
this: The query pulls all the records from inventory that has a matching
model code to the "body codes" in the 2 incentive tables with the exception
of "body codes" that are only listed in either the 2004 or 2005 incetive
tables. In other words the "body code" must be listed in both 2004 and 2005
Incentive tables in order for the query to pull the matching records.
However there are some "body codes" that are only found in either the 2004
or in the 2005 incentive table. How can I make this query pull all of the
records that have a match in "Total Inventory" if they don't have a match
in the other incentive table? I have already tried changing the
relationships to left join or right join, but both of these give me an
error that says: the SQL statement could not be executed because it
contains ambiguous outer joins. Does anyone have any suggestions?




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Nested in-line Query laura Running & Setting Up Queries 0 February 11th, 2005 12:17 AM
Criterion - How to Write Query for Multiple Tables jcinn Running & Setting Up Queries 1 February 8th, 2005 12:42 PM
adding 2 fields including null entries Jesse Running & Setting Up Queries 26 January 18th, 2005 05:31 PM
Print Taher Setting Up & Running Reports 1 August 31st, 2004 09:07 PM
Display Relational tables in a query Bill Duris Running & Setting Up Queries 1 July 23rd, 2004 03:37 AM


All times are GMT +1. The time now is 04:52 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.