Jump to content

Insert into .. Select


fesan

Recommended Posts

Hello....

I want to copy a whole row from one table to another.

I found the INSERT INTO .. SELECT function, but i want to "simplify" it if possible.

 

as i understood i have to write out every field that i want to insert to, but i want to insert in to every field. it there a way to use * in this function?

 

I want to do this because the table I'm inserting to is a history table... so when ever a field in the mail table is updated a copy of the old one is inserted in to the history table....

Link to comment
https://forums.phpfreaks.com/topic/150860-insert-into-select/
Share on other sites

Now I've solved out some issues but i still get a error:

 

Column count doesn't match value count at row 1

 

I've deleted the extra id field, and made the two tables exactly the same....

Could this be the Auto increment i have on my main table that is failing?

 

Because the ID field in my history table is not an auto increment field.

Link to comment
https://forums.phpfreaks.com/topic/150860-insert-into-select/#findComment-792497
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.