Jump to content

Help copying table columns


Ptreese84

Recommended Posts

Hello,

mysql 5.1.36

php 5.3.0

 

I searched the forums but im not sure what im looking for.

Im trying to copy table columns. Basically each row is setup as:

 

name, id, storeid, a1, a2, a3, a4, b1, b2, b3, b4

 

i need a way to copy a1 to b1, a2 to b2, a3 to b3, a4 to b4 where storeid = "value"

 

there are multiple users with the same storeid.. so it will need to loop through each one. Im sure this is a noob question and i apologize in advance. I tried

"INSERT INTO table (b1, b2, b3, b4) SELECT a1, a2, a3, a4 FROM table WHERE storeid = '$value'";

but that did not work. No errors, just returns '1'.

Not sure what else to try.

Any help is appreciated.

Thx in advance.

 

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.