Forum Moderators: open
I have a basic question about a MySQL db. If I have a table of names, numbers and images (those are the column names) and I want to insert that same data into a 22 column table as an autofill so that I don't have to hand type each name into the db, which command do I use?
I've tried INSERT INTO and I've tried join-ing...and those have generated errors.
How do I get the values from three columns into the new table? BTW--I used the same names for these columns and even put them in the same order in phpmyadmin
Thanks all...I do not need someone to do the work for me but just to point me in the right direction.
create table test2 (id int(11) primary key auto_increment, fname varchar(255), lname varchar(255));
insert into test1 (fname,lname) values('John','Smith');
insert into test1 (fname,lname) values('Mary','Jones');
insert into test1 (fname,lname) values('Seymour','Butz');
insert into test2(select * from test1);
select * from test2;
And you know the result. :-)
Specific cols:
insert into test2 (fname,lname) (select fname,lname from test1);
anyhow...i entered the first column and it went well...the second insert however..created new rows with the firstname and lastname columns.
and if i try to enter all three columns at one time i get an error.