Results 1 to 2 of 2
  1. #1
    carillonator is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1

    UNION two tables with same primary key values

    I want to perform a UNION of two tables, but occasionally the primary key field in each will have the same value. In this case I want only the row from table1:

    table1
    Code:
    col1       col2
    Frank     blue
    Debbie   red
    table2
    Code:
    col1        col2
    George    brown
    Debbie     orange
    The result I want:
    Code:
    col1        col2
    Frank      blue
    Debbie     red
    George    brown


  2. #2
    MAF4Fam6's Avatar
    MAF4Fam6 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Location
    Fruit Heights, Utah USA
    Posts
    140
    Not sure, if what you are trying to do, is even possible since your Primary Key's values are duplicated in certain records.
    An option would be to create a third table (Table 3).
    Then, Append ALL records from Table 1 to Table 3 first.
    Then, Append ALL records from Table 2 to Table 3. During the Append process of Table 2 To Table 3, the duplicate records by Primary Key from Table 2 would reject if they already exist in Table 3.

    -RC

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

Similar Threads

  1. Need help with a Union Query
    By jdowdy in forum Access
    Replies: 1
    Last Post: 10-13-2009, 05:24 PM
  2. Create table out of union query
    By DKruse1969 in forum Queries
    Replies: 2
    Last Post: 08-28-2009, 09:55 AM
  3. Replies: 0
    Last Post: 12-28-2008, 01:56 PM
  4. lookup values in backend tables
    By deb56 in forum Database Design
    Replies: 1
    Last Post: 01-23-2008, 11:12 AM
  5. Replies: 1
    Last Post: 06-20-2007, 07:26 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