Results 1 to 3 of 3
  1. #1
    Freddie81 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2018
    Posts
    149

    Union Query from 3 tables?

    Hi again fellow members



    I've got a slight dilemma. My union query works when I combine 2 tables but when I try 3 it doesn't. Could someone please explain to me how to go about using 3 tables in a union query?

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    In order for your Union query to work, all the fields you are returning must "line-up" and be the same data type.
    Also, look for any errors in the data in the third table you are trying to add. That could cause issues.

    If you still cannot figure it out, please post the SQL code you are trying for this Union Query, and maybe some sample data.

  3. #3
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,979
    Quote Originally Posted by JoeM View Post
    In order for your Union query to work, all the fields you are returning must "line-up" and be the same data type.
    Also, look for any errors in the data in the third table you are trying to add. That could cause issues.

    If you still cannot figure it out, please post the SQL code you are trying for this Union Query, and maybe some sample data.
    To elaborate on Joe's point, you must have the same number of fields with the same datatype for each corresponding fields in the same order
    So if the first 2 tables have 6 fields & the third has 5 with a 'missing 4th field', add an empty DUMMY field (e.g. '' AS Dummy) in that position
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. Replies: 2
    Last Post: 09-14-2017, 06:02 AM
  2. Replies: 4
    Last Post: 08-09-2017, 12:06 PM
  3. Replies: 4
    Last Post: 12-20-2015, 02:35 PM
  4. Replies: 9
    Last Post: 10-08-2015, 05:13 AM
  5. Replies: 1
    Last Post: 07-03-2012, 02:47 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