Results 1 to 4 of 4
  1. #1
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419

    Access SQL - FULL OUTER JOIN

    Hello,

    I noticed ACCESS SQL doesn't have full outer join. So instead the person writing the SQL statement needs to use UNION ALL.
    However I noticed this is not the best way as it doesn't always work, and doesn't always give the proper result.
    I have an example that I had tried that I like to share.



    I have a table of 40k or it can be 400k records.

    Query 1 -
    I want to find the counts of all the particular item's occurrence in field A.

    Query 2-
    With the same table, I want to find the counts of all the particular item's occurrence in field B.

    In the two field, there may be items that are not the same - appear in one but not the other and we don't know how many are not the same
    (if the programmer do Inner join - he/she could only see same occurrence in both).

    I want to join Query 1 and Query 2 together by their item identity (field A & field B) but I want to do full outer join because I want to see all items
    even the ones that is in one but not the other. It needs a GROUP BY in each query because it needs the count of items in query A and counts of items in query B

    I tried Union but it doesn't work. It just puts them from top to bottom (all results) but you don't know
    what item below to what field, it doesn't put them side by side for the two fields of all the items that are there and their count.

    - if someone has an SQL statement that works or does it ?

    Please advise

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    i use outer joins all the time and they work for me.

  3. #3
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    Dependiing on your needs:
    Union ALL includes duplicates/replicates.

    Union does not.
    You may want to look at the UnMatched query in Access to find values of field in A not B and vice versa.

    Right Join
    Left Join
    Inner Join

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    To clarify, Access does not support FULL OUTER JOIN. The normal workaround is to union together the 3 joins Orange linked to:

    SELECT...FROM...LEFT JOIN...
    UNION ALL
    SELECT...FROM...RIGHT JOIN...
    UNION ALL
    SELECT...FROM...INNER JOIN...

    If that isn't working for you, a sample db might help us figure it out.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Full Outer Join -- How to?
    By WesHarding in forum Queries
    Replies: 5
    Last Post: 03-20-2017, 10:40 AM
  2. Replies: 3
    Last Post: 03-05-2015, 02:28 PM
  3. Replies: 4
    Last Post: 12-22-2014, 08:48 PM
  4. Replies: 3
    Last Post: 01-21-2014, 12:28 AM
  5. 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

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