Linking four table/What Type of Query Do I use

TBC

Registered User.
Local time
Today, 14:47
Joined
Dec 6, 2010
Messages
145
What type of Query Should I use so My Data don’t Duplicate? Please Help!

I'm wondering what would be the correct way to combined queries that have two columns that are different, but need to be added to the same report

I’m trying to link four tables together.
In one table I'm going to be using all the fields [Feild1],[Feild2],[Feild3],[feild4]

In the other 3 queries I would like to all a column and put one row of data from each other query's [Feild1],[Feild2],[Feild3],[feild4] adding [FieldA],FieldB]

This shows just a select query in access, putting the tables together

[SQL]
SELECT Wholesale_Rank_qry_2.OMNI_Number,
Wholesale_Rank_qry_2.branch,
Wholesale_Rank_qry_2.branch_name,

Wholesale_Rank_qry_2.[Wholesale_Rank>],
Table_Rank_qry_2.[Table_Rank>],
Purchase_Rank_qry_2.[Purchase_Rank>],
CUSB_Rank_qry_2.[CUSB_Rank>]

FROM CUSB_Rank_qry_2 RIGHT JOIN (Purchase_Rank_qry_2 RIGHT JOIN (Table_Rank_qry_2 RIGHT JOIN Wholesale_Rank_qry_2 ON Table_Rank_qry_2.OMNI_Number = Wholesale_Rank_qry_2.OMNI_Number) ON Purchase_Rank_qry_2.OMNI_Number = Wholesale_Rank_qry_2.OMNI_Number) ON CUSB_Rank_qry_2.OMNI_Number = Wholesale_Rank_qry_2.OMNI_Number; [/sql]

The main table with all the data in it is Wholesale_Rank_qry_2. <-This table will have all of the Wholesale_Rank field’s populated.

Now the queries below will only have the rank field populated if they have a rank from there original table

Table_Rank_qry_2.[Table_Rank>],
Purchase_Rank_qry_2.[Purchase_Rank>],
CUSB_Rank_qry_2.[CUSB_Rank>]

Thanks for taking the time to help me learn more about what queries I can us

TCB
 

Attachments

Last edited:
Data will be duplicated when a record in one table has a link to more than one record in another table.

In your case it is difficult to pin point the exact problem without a sample database.
If this answer didn't help you, try to generalise the question or post a sample database describing the problem.

HTH:D
 
HTH, I have attached a sample databse. let me know if I can do anything else
 
I don't quite understand, just looking at the CUSB_Rank tables OMNI 1441 doesn't seem to appear in the other tables, in fact none of the records appear in the Purchase_Rank table.

What exactly are you trying to acheive?

Simon
 

Users who are viewing this thread

Back
Top Bottom