I have two table with the same fields. What would be the shortest SQL statement to copy a record from this table to another? I make one like this: insert into table1 (table1.) select table2. from table2 where table2.id = 1; and it was error: 1136 - Column count doesn't match value count at row 1. What was wrong? What was the way of doing something like this without listing all the fields on both tables. Thanks.
insert into table1 select * from table2 where id = 1
Sweet!! Work perfect! Thanks for the super fast reply. Can you tell me what's wrong with my SQL statement?
You only need to have the () after the table name if you don't insert values into all columns. In that case you should specífy a comma separated list of column names.
E.g.
insert into table1(a,b) select a,b from table2