Merging Data from two source into one destination table

  • How do I merge data from two source tables into one destination table? (Note that the two source tables have some records that were entered in them. I'd hope to get rid of all duplicates in the destination table after the merge.) Thanks.

  • If the table structure matches you can use UNION which will remove duplicates also .

    select * from table1

    UNION

    select * from table2

  • Just though I should add that you can also use INTO in a UNION statement to load the data into a new table. Just be aware that only the first SELECT will contain the INTO keyword.

    SELECT * INTO NewTable FROM FirstTable

    UNION ALL

    SELECT * FROM SecondTable


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply