sql - Access - Merge two databases with identical structure -


I would like to write a query that will merge two Access 2000 databases into one. Each has 35 tables with the same field and mostly unique data will be the same "primary key" in some rows, in which case the row should always be preferred on the database from A database A. I use quotes around "primary key" because the database is generated without any keys or relationships. For example:

Database A, Table 1

  col1 col2 frank red debbie blue  

database b, table 1

  col1 col2 heli orange debbie pink  

and I want the result:

  col1 col2 Frank Red Harry orange debbie blue  

These databases are generated and downloaded by non-SQL-savvy users, so I want to give them just one query to copy and pasteObviously they have to start by importing or adding a db [other] to them.

I feel like I have to create a third table with the combined result query and then the second two have to be removed. Ideally, though, it will only add rows of database A to database B (override where necessary).

I'm not looking for a complete answer, just hoping for some advice from where to start, I have some SSQL experience and the basics of getting involved. Is it possible to do all this in one query, or do I have to do one for each table separately?

Thank you !!

how about:

  SELECT t.ID, t Select the union from NewTable FROM (SELECT a.ID, a.Field1, A.Field2 Table 1 in field1, t.Field2, x.id, x.Field1, x.Field2 in Table 1X in 'C: \ docs \ db2. Mdb 'where x.ID is not (select ID from Table 1))  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -