Forum Moderators: open

Message Too Old, No Replies

MySql - Moving data from one row to another

How to move information to a newly created row

         

Montbazin

12:38 am on Nov 4, 2005 (gmt 0)

10+ Year Member



Hello
On my MySql based website, I want to update one of my Tables. In order to add the new (Date) row, I did :
$res = "ALTER TABLE $tbname ADD col_4 DATE NOT NULL AFTER col_3";
etc...

This worked fine, but now I would like to copy the "Dates" which are in

col_1
into the newly created
col_4

How can I do this? I have tried with

INSERT
and
REPLACE
but I didn't manage to achieve it.

Thanks for your help!
Roberto

syber

1:08 am on Nov 4, 2005 (gmt 0)

10+ Year Member



Couldn't you just do the following?


UPDATE $tbname
SET col_4 = col_1

dba_guy

3:31 am on Nov 4, 2005 (gmt 0)

10+ Year Member



Yes, that would work fine.

Montbazin

9:08 am on Nov 4, 2005 (gmt 0)

10+ Year Member



Splendid, it worked
many thanx

roberto