Results 1 to 5 of 5
  1. #1
    LilMissAttack is offline Novice
    Windows XP Access 2007
    Join Date
    May 2010
    Posts
    26

    Union query (or Inner/Outer join?)

    Hi,

    I am having trouble pulling data I want from 3 select queries, I thought I could do this with a Union query but maybe I need some kind of join? This is the first time I've done this so any help would be appreciated....

    I have 3 tables, all with the same fields. Each table represents a benefit - Medical, Dental and Vision.

    So for instance, John Doe could be on the Medical table and have his coverages listed, but also appear on the dental and/or vision. Jane Doe could be on Vision but not any of the other tables. Another person could be on Dental and Vision....etc.

    I need it to pull ALL records and have ALL their info on one line...


    But sometimes their address might appear on one table but not the other so I need it to pull that too....

    Am I doing this right with a Union Query? Maybe I need some additional SQL (which I barely know anything about?) Right now when I'm pulling it, it gets everyone but has a separate line for Medical, Dental Vision etc.

    Thanks for your help!

  2. #2
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    you need union plus outer joins. Should be complicated because you have 3 tables and you don't want to miss any one.

  3. #3
    LillMcGill is offline Dagny fan
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Oct 2010
    Location
    Southern USA
    Posts
    70
    create and close a union query
    Create a new query. Include the Unionqry and all the tables.
    Change all the joins to include all the records from the Unionqry
    ------------------------------

    EDIT: I am too slow!

  4. #4
    LilMissAttack is offline Novice
    Windows XP Access 2007
    Join Date
    May 2010
    Posts
    26
    Thank you for your answers, it helps so much... forgive me if this is a silly question, but should I be joining all the fields to all the fields in the union query? Sorry I can't seem to wrap my mind around this...
    Thanks again

  5. #5
    LillMcGill is offline Dagny fan
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Oct 2010
    Location
    Southern USA
    Posts
    70
    Hopefully, you have a single-field primary key in these tables... join the primary key field in the Unionqry to the primary key in each of the tables.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Union Query Question
    By jpkeller55 in forum Access
    Replies: 2
    Last Post: 09-24-2010, 10:18 AM
  2. Ambiguous Outer Join Error
    By scruiks in forum Queries
    Replies: 3
    Last Post: 07-18-2010, 05:06 PM
  3. I can't get a full outer join to work
    By Bobt1993 in forum Queries
    Replies: 3
    Last Post: 03-20-2010, 10:05 AM
  4. Need help with a Union Query
    By jdowdy in forum Access
    Replies: 1
    Last Post: 10-13-2009, 05:24 PM
  5. Dynamic Query Outer Join Problem
    By mjack003 in forum Queries
    Replies: 0
    Last Post: 07-21-2006, 01:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums