Link to home
Start Free TrialLog in
Avatar of smoothcat11
smoothcat11

asked on

Add an ID to a Table w/ Auto Increment

Hello, I have 2 tables that I uploaded.  They have the same fields, but no id.  I want to combine them in a new table and I need to add an id to the table:

Table 'ContactsPart1':
first_name, last_name, phone

Table 'ContactsPart2':
first_name, last_name, phone

I want it to be:
Table 'ContactsAll'
id,first_name, last_name, phone

I copied ContactsPart1 structure and added id made it primary key and auto increment.

When I try the following command:
INSERT INTO `ContactsAll` SELECT first_name, last_name, phone FROM `ContactsPart1`

I get:
MySQL said:  
#1136 - Column count doesn't match value count at row 1

How do I get the info in to the new table w/ a SQL command and unique id for each record?  

I'm using php, but would rather do this through a SQL command.  Thank you for your time.
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of smoothcat11
smoothcat11

ASKER

YOU ARE AWESOME!!!  You just saved me so much time!  Thank you...