Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

replacing contents of 1 column 1

Status
Not open for further replies.

Halfcan

Technical User
Dec 8, 2002
214
US
Hello,

Does anyone know how to replace the contents of 1 column of a table?

I've figured out how to dump the entire table to a file using:
mysql> SELECT * INTO OUTFILE '/tmp/filename.txt' FIELDS TERMINATED BY ',' FROM TableName;

and how to load the entire table back in using:
mysql> load data infile '/tmp/filename.txt' into table TableName;

but I'm only want to manipulate 1 column of data.

Basically, I want to copy the data from 1 column, and paste it into a different column.

I'm new to mysql, and I've been looking through the mysql reference manual all day, and it's making my brain hurt because I don't always understand the syntax of the manual....

I'm using mysql 4.0.21
Thanks,
Andy T
 
i believe you can do something like

update tblname set col2=co1 where somecol='something'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top