Pittrap’s Weblog

Random stuff

Archive for the ‘Coding’ Category

MySQL copy one or more fields from one table into another table

Posted by Tim on March 20, 2008

If you’re trying to copy the data from some fields in one MySQL table into a different table you’d do it like so:

INSERT INTO TableOne (Username, Password, Email) (SELECT usern, passw, emailaddress FROM TableTwo)

Posted in Coding, MySQL | Tagged: , | Leave a Comment »

MySQL copy one field to another

Posted by Tim on March 9, 2008

If you’re trying to copy the entire contents of one MySQL field into another MySQL field it’s very easy to do.

UPDATE table SET field_a=field_b

table is the name of your table in MySQL
field_a is the field you want to copy to
field_b is the field you want to copy from

Posted in Coding, MySQL | Leave a Comment »