Hi!

Am Mo, den 31.01.2005 schrieb Syed Ali um 17:14:
> Does anyone know the easiest way to copy a column in mysql?
> 
> I have a table (table1) which has 4 columns, I want to copy all the
> contents of col1 into col2. 
> Col3 is the primary unique key, so the copy has to keep the data matched
> with col3.

UPDATE table1 SET col2 = col1
is the SQL way of doing that.
Requirements: compatible column types.

If you want to do it for some rows only, add a WHERE condition.

> 
> I guess one possible way is to do a select and output to a file and then
> read from the file for input into col2.

Yes, if you want to do it the hard way.


HTH,
Joerg Bruehe

-- 
Joerg Bruehe, Senior Production Engineer
MySQL AB, www.mysql.com
Office:  (+49 30) 417 01 487

Are you MySQL certified?  www.mysql.com/certification


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to