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
Share on other sites

ok....

 

well, i have added one field to the history table.

this is because i want to keep the id from the old table and make a new id in the history table....

 

I'll try it out and see how it goes! :)

 

thanks! :D

Link to comment
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.