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
https://forums.phpfreaks.com/topic/221668-help-copying-table-columns/
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.