Results 1 to 2 of 2
  1. #1
    mschles4695 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2010
    Posts
    1

    Outer left join leaves out null values

    I am joining two tables that have 3 fields in common and all 3 are needed to match the records uniquely; the three joins are Access left outer joins. However, if in table 1 one of the field is null, a record will not be returned eventhough there are matching values in the other two fields. I am joining an employee table with location information in a building field, floor field and room field (all text) to a Rooms table with the same three fields. In this case the employee has values in all fields but the Rooms table has a null in the floor field for the record with the same building and room IDs. So, since I am counting the number of records returned, in this case I am missing a record.



    IS THERE A WAY TO GET AROUND THIS?????? HELP PLEASE!!!!

  2. #2
    ConneXionLost's Avatar
    ConneXionLost is offline Simulacrum
    Windows XP Access 2003
    Join Date
    Jan 2010
    Location
    Victoria, Canada
    Posts
    291
    You need to properly normalize your Rooms table with unique primary key and use that instead of depending on a compound key with missing values.

    In other words, instead of this:

    Code:
    Building	Floor	Room
    Red	Main	101
    Red	Main	102
    Red	Second	201
    Blue	Main	101
    Blue	Second	201
    use this:

    Code:
    RoomID	Building	Floor	Room
    1	Red	Main	101
    2	Red	Main	102
    3	Red	Second	201
    4	Blue	Main	101
    5	Blue	Second	201
    The employee table would only use the RoomID field.

    Cheers,

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

Similar Threads

  1. Union query (or Inner/Outer join?)
    By LilMissAttack in forum Queries
    Replies: 4
    Last Post: 10-23-2010, 12:36 AM
  2. Ambiguous Outer Join Error
    By scruiks in forum Queries
    Replies: 3
    Last Post: 07-18-2010, 05:06 PM
  3. Problem with Left Join & VB6
    By msrdjan1 in forum Queries
    Replies: 0
    Last Post: 03-30-2010, 01:48 AM
  4. 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
  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