A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Merging Two Identical Databases (Access 2000 format)



 
 
Thread Tools Display Modes
  #11  
Old June 13th, 2008, 08:58 PM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Merging Two Identical Databases (Access 2000 format)

On Fri, 13 Jun 2008 07:01:01 -0700, bryan
wrote:

All I want is for all the records in both tables to transfer into one
complete table without having to re-enter all the records again. A
synchronization if you will...


Again:

You have a record for AT&T in one table.
You have a record for AT&T in the other table, with *different data*.

What do you want in the final table?

You say you want all the records.
You also say you cannot have any duplicate company names.

These two requirements are in conflict. How do you want that conflict
resolved?
--

John W. Vinson [MVP]
  #12  
Old June 16th, 2008, 06:29 PM posted to microsoft.public.access.tablesdbdesign
Bryan
external usenet poster
 
Posts: 344
Default Merging Two Identical Databases (Access 2000 format)

Ok. I have two tables. They both consist of these 5 fields: Company Name,
Address, State, Zip Code, Phone Number. Not much of a database but it serves
its purpose of having a quick lookup for company info without having to dig
through a huge rolodex. There are some companies in one table and some
companies in the other. I want all the records in both tables to be put into
one table without having to re-enter every record. The reason I say that I
don't want any "duplicates" is because some of the companies appear in both
tables but the records are exactly the same. I'm not sure how some companies
got entered into both tables but like I said I kinda inherited this mess.
People are getting confused about which table is which and that's why they
want me to put these two tables into one in the first place. Sorry for all
the confusion and thanks for all the patience.


"John W. Vinson" wrote:

On Fri, 13 Jun 2008 07:01:01 -0700, bryan
wrote:

All I want is for all the records in both tables to transfer into one
complete table without having to re-enter all the records again. A
synchronization if you will...


Again:

You have a record for AT&T in one table.
You have a record for AT&T in the other table, with *different data*.

What do you want in the final table?

You say you want all the records.
You also say you cannot have any duplicate company names.

These two requirements are in conflict. How do you want that conflict
resolved?
--

John W. Vinson [MVP]

  #13  
Old June 16th, 2008, 08:22 PM posted to microsoft.public.access.tablesdbdesign
Michael Gramelspacher
external usenet poster
 
Posts: 482
Default Merging Two Identical Databases (Access 2000 format)

On Fri, 13 Jun 2008 07:01:01 -0700, bryan
wrote:

All I want is for all the records in both tables to transfer into one
complete table without having to re-enter all the records again. A
synchronization if you will...


This is the general concept. Table2 is merged into table 1, excepting the
duplicates.

INSERT INTO Table1
(field_a,
field_b,
field_c)
SELECT field_1,
field_2,
field_3
FROM Table2
WHERE NOT EXISTS (SELECT *
FROM Table1
WHERE Table1.field_a = Table2.field_1
AND Table1.field_b = Table2.field_2
AND Table1.field_c = Table2.field_3);
  #14  
Old June 17th, 2008, 01:03 AM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Merging Two Identical Databases (Access 2000 format)

On Mon, 16 Jun 2008 10:29:01 -0700, bryan
wrote:

Ok. I have two tables. They both consist of these 5 fields: Company Name,
Address, State, Zip Code, Phone Number. Not much of a database but it serves
its purpose of having a quick lookup for company info without having to dig
through a huge rolodex. There are some companies in one table and some
companies in the other. I want all the records in both tables to be put into
one table without having to re-enter every record. The reason I say that I
don't want any "duplicates" is because some of the companies appear in both
tables but the records are exactly the same. I'm not sure how some companies
got entered into both tables but like I said I kinda inherited this mess.
People are getting confused about which table is which and that's why they
want me to put these two tables into one in the first place. Sorry for all
the confusion and thanks for all the patience.


If the company name is the Primary Key as you indicate upthread, you can
simply run an append query:

INSERT INTO Table1 ([Company Name],
[Address], [State], [Zip Code], [Phone Number])
SELECT [Company Name],
[Address], [State], [Zip Code], [Phone Number] FROM Table2;

Copy and paste this SQL into the SQL window of a new query; change Table1 and
Table2 to the actual names of your tables (as written it will add all of the
records from Table2 into Table1). When you run the query you'll get a warning
message

32 records were not added due to key violations

or something of the sort; these are just the duplicates that are being
rejected, everything else will be added.
--

John W. Vinson [MVP]
  #15  
Old June 17th, 2008, 02:21 PM posted to microsoft.public.access.tablesdbdesign
Bryan
external usenet poster
 
Posts: 344
Default Merging Two Identical Databases (Access 2000 format)

Perfect! Thank you John and everyone else for all the help and patience. My
new mission is to learn as much as possible about working a database.


"John W. Vinson" wrote:

On Mon, 16 Jun 2008 10:29:01 -0700, bryan
wrote:

Ok. I have two tables. They both consist of these 5 fields: Company Name,
Address, State, Zip Code, Phone Number. Not much of a database but it serves
its purpose of having a quick lookup for company info without having to dig
through a huge rolodex. There are some companies in one table and some
companies in the other. I want all the records in both tables to be put into
one table without having to re-enter every record. The reason I say that I
don't want any "duplicates" is because some of the companies appear in both
tables but the records are exactly the same. I'm not sure how some companies
got entered into both tables but like I said I kinda inherited this mess.
People are getting confused about which table is which and that's why they
want me to put these two tables into one in the first place. Sorry for all
the confusion and thanks for all the patience.


If the company name is the Primary Key as you indicate upthread, you can
simply run an append query:

INSERT INTO Table1 ([Company Name],
[Address], [State], [Zip Code], [Phone Number])
SELECT [Company Name],
[Address], [State], [Zip Code], [Phone Number] FROM Table2;

Copy and paste this SQL into the SQL window of a new query; change Table1 and
Table2 to the actual names of your tables (as written it will add all of the
records from Table2 into Table1). When you run the query you'll get a warning
message

32 records were not added due to key violations

or something of the sort; these are just the duplicates that are being
rejected, everything else will be added.
--

John W. Vinson [MVP]

  #16  
Old June 18th, 2008, 01:33 AM posted to microsoft.public.access.tablesdbdesign
David W. Fenton
external usenet poster
 
Posts: 3,373
Default Merging Two Identical Databases (Access 2000 format)

=?Utf-8?B?YnJ5YW4=?= wrote in
:

Thank you John and everyone else for all the help and patience. My
new mission is to learn as much as possible about working a
database


John's suggestion is a pretty arbitrary way to resolve the
duplicates. How do you know that the second table does not have
useful data in it, such as phone numbers that are missing from the
first table?

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
  #17  
Old June 18th, 2008, 01:46 AM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Merging Two Identical Databases (Access 2000 format)

On 18 Jun 2008 00:33:36 GMT, "David W. Fenton"
wrote:

=?Utf-8?B?YnJ5YW4=?= wrote in
:

Thank you John and everyone else for all the help and patience. My
new mission is to learn as much as possible about working a
database


John's suggestion is a pretty arbitrary way to resolve the
duplicates. How do you know that the second table does not have
useful data in it, such as phone numbers that are missing from the
first table?


True, but I was relying on the accuracy of Bryan's statement upthread:

The reason I say that I
don't want any "duplicates" is because some of the companies appear in both
tables but the records are exactly the same.

If there are in fact discrepancies you would certainly need a more complex
approach; the worst case would be that both tables have a phone number... but
they are DIFFERENT phone numbers.
--

John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:42 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.