Results 1 to 4 of 4
  1. #1
    kestefon is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    108

    Do fields have to be in the same order for a union?

    Hi Everyone,



    I have some tables with identical field names, but the fields are in a different order. Is it possible to do a union like this, or do I have to rearrange the data within each table first?

    For instance:

    Table A: Field1, Field4, Field2, Field3
    Table B: Field3, Field1, Field4, Field2
    Table C: Field2, Field3, Field1, Field4

    And I'm trying to combine those tables into TableABC: Field1, Field2, Field3, Field4.

  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,930
    Can do that and the data will appear in the columns in that order. If fields are not same datatype the query could error. The first line defines datatype and field names.

    So unless you want Field1 data from Table A to mix with Field3 from Table B and Field2 from TableC, list fields in the same order.
    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
    kestefon is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    108
    Thanks. So, I will definitely have to rearrange each table's fields before attempting a UNION? I want to confirm that there's no way around it...

  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,930
    Sorry, I didn't explain that very well.

    The table order can be ignored if the fields are explicitly listed in the UNION query.
    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.

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

Similar Threads

  1. Format two fields in a Union Query as Currency
    By alansidman in forum Queries
    Replies: 1
    Last Post: 12-14-2012, 12:41 PM
  2. Replies: 14
    Last Post: 11-09-2012, 01:19 PM
  3. Search form fields in alpha order
    By snowboarder234 in forum Forms
    Replies: 1
    Last Post: 11-02-2012, 12:03 PM
  4. Union Query (choosing between two fields)
    By naveehgreen in forum Programming
    Replies: 1
    Last Post: 06-17-2010, 03:24 PM
  5. Fields order changes on sending to excel
    By captgnvr in forum Import/Export Data
    Replies: 1
    Last Post: 10-01-2009, 09:29 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