Results 1 to 5 of 5
  1. #1
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265

    Full outer join (from UNION ALL on 3 queries) returning same rows more than one

    I took 3 select queries and did a UNION ALL to get a FULL outer join. I see some records repeating, 3 times to be exact. I presume the first occurrence is from the INNER join, the second from the LEFT outer join and the third from the RIGHT outer join.

    How can I get these repeating records to appear only once?

    In the case of all other records, i.e. LEFT outer join that does not match with the "Right" table and vice versa, it seems that they are appearing only once, which is fine.



    I have tried the GROUP BY statement, then listed all fields after each query. This didn't work. I tried the GROUP BY statement just once after all 3 queries and still this did not work.
    Last edited by Access_Novice; 12-20-2014 at 11:25 PM. Reason: Added GROUP BY comment.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Build the UNION query then use it as source for other queries.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265
    Ok. I created the Union query and I'm using it as a source now. I can't do Group By because then I will be asked to specify an aggregate function which I don't want or need.

    I found a Query property called "Unique Records" which I changed to "Yes." But this did not remove duplicate records.

    Any ideas?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265
    Quote Originally Posted by June7 View Post
    If you want to provide db for analysis, follow instructions at bottom of my post.
    I tried using SELECT DISTINCT in the SQL code and it worked.

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

Similar Threads

  1. Replies: 4
    Last Post: 01-23-2014, 03:07 PM
  2. Replies: 3
    Last Post: 01-21-2014, 12:28 AM
  3. Outer join not returning null values.
    By Count Duckula in forum Queries
    Replies: 3
    Last Post: 08-15-2013, 10:03 AM
  4. Union query (or Inner/Outer join?)
    By LilMissAttack in forum Queries
    Replies: 4
    Last Post: 10-23-2010, 12:36 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

Tags for this Thread

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