What type of Query Should I use so My Data don’t Duplicate?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dave Smith
    New Member
    • Dec 2010
    • 72

    #1

    What type of Query Should I use so My Data don’t Duplicate?

    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_Numb er,
    Wholesale_Rank_ qry_2.branch,
    Wholesale_Rank_ qry_2.branch_na me,

    Wholesale_Rank_ qry_2.[Wholesale_Rank>],
    Table_Rank_qry_ 2.[Table_Rank>],
    Purchase_Rank_q ry_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_Numb er) ON Purchase_Rank_q ry_2.OMNI_Numbe r = Wholesale_Rank_ qry_2.OMNI_Numb er) ON CUSB_Rank_qry_2 .OMNI_Number = Wholesale_Rank_ qry_2.OMNI_Numb er; [/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_q ry_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

    I'm looking to see all the records from Wholesale Rank, but then in the other fields that come from a different table would show blank fields because they don’t have records for all three tables
  • Brian Connelly
    New Member
    • Jan 2011
    • 103

    #2
    Did you try adding a condition such as Not Null. This would only return fields that have data in them.

    Comment

    Working...