Merge duplicate valus

mixalisaspr

Registered User.
Local time
Yesterday, 22:54
Joined
Nov 8, 2011
Messages
15
Hi I have a large table with many duplicate names, but with different phone numbers. I want to merge them so as each name to be connected to a table with all phones. eg.

From Table1 to go to Table_Names and Table_Phones as in picture

Any ideas?
 

Attachments

  • tables.png
    tables.png
    16.5 KB · Views: 118
just check if below gives some guidelines :
First Table to generate :
qrytblNames
Code:
SELECT 
	Min(Table1.ID) AS MinOfID, 
	Table1.Last_Name, 
	Table1.First_Name 
	INTO 
	Table_Names
FROM 
	Table1
GROUP BY 
	Table1.Last_Name, 
	Table1.First_Name;

Second Table to generate :
qryPhoneTable
Code:
SELECT 
	Table_Names.MinOfID, 
	Table_Names.Last_Name, 
	Table_Names.First_Name, 
	Table1.Last_Name, 
	Table1.First_Name, 
	Table1.Phone, 
	Table1.Notes 
	INTO 
	Table_Phones
FROM 
	Table_Names 
	INNER JOIN 
	Table1 
	ON 
	(Table_Names.Last_Name = Table1.Last_Name) 
	AND 
	(Table_Names.First_Name = Table1.First_Name);

Thanks
 
table1 looks redundant to me, that could be done from a query from your other tables, your table_phones also needs a PK unles you using the fields as comp_PK
 

Attachments

  • tables.jpg
    tables.jpg
    34.8 KB · Views: 101
Last edited:
Glad you found it helpful.
Hope you don't have 2 or more different persons with the same Last_Name & First_Name.

Thanks:)
 

Users who are viewing this thread

Back
Top Bottom