Results 1 to 5 of 5
  1. #1
    learning_graccess is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2011
    Posts
    40

    how to update in a table union all query


    I want to join two tables irrespective of duplicates so I wrote union all query . Now i want to update this into the table. I don't know how to write the query. Can you please help with this?

  2. #2
    mejia.j88 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Location
    california
    Posts
    228
    can you create and update query based on your union all query, and use it to update the table?

  3. #3
    learning_graccess is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2011
    Posts
    40
    hi mejia, i don't know what you are asking. here i'm repeating with examples. Table1 contains a column file "number" and its values are 0,1,2,3,4,5,6,7,8,9,10). Table2 contains a column field "number" and its values are (0,1,2,3,4,5,6,7,8,9,10). Now I want to add table1 values into table2 so that in table2 output are (0,1,2,3,4,5,6,7,8,9,10,0,1,2,3,4,5,6,7,8,9,10)
    I tried this but it doesn't work

    insert into table2 (number)
    select number from table1;

  4. #4
    mejia.j88 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Location
    california
    Posts
    228
    Hi learning,
    i believe what you need is either an update query or an append query.
    could you post a snap shot of your two tables?
    i'd like to see the fields they contain.
    if you only have that field, [number], then you can use an append query to add the records from table 1 to table 2. if you have other fields, it is important to consider how the record additions will match up with the existing data.

  5. #5
    learning_graccess is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2011
    Posts
    40
    insert into table2 (number)
    select number from table1;
    The above code was correct. The only thing I had to refresh.

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

Similar Threads

  1. Select Query > Update Query > Table Field
    By tuggleport in forum Queries
    Replies: 2
    Last Post: 08-09-2012, 07:04 AM
  2. Replies: 1
    Last Post: 02-08-2012, 04:50 PM
  3. Replies: 2
    Last Post: 12-20-2011, 07:33 AM
  4. Replies: 1
    Last Post: 12-16-2011, 08:16 AM
  5. Create table out of union query
    By DKruse1969 in forum Queries
    Replies: 2
    Last Post: 08-28-2009, 09:55 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