Jump to content

Duplicating A Column


Eiolon

Recommended Posts

I have an existing MySQL database with the column:

 

date_added set as DATETIME

 

I created a new column called:

 

date_edited set as DATETIME

 

What I would like to do is set the DATETIME found in the date_added column into date_edited column for each record without having to do it individually.

 

Any painless way of doing such a thing?

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/272192-duplicating-a-column/
Share on other sites

additional to Requinix answer:

 

If you idea is to maintain in that column the date/time of the last record modification, as its seems, then you should read this:

http://dev.mysql.com/doc/refman/5.5/en/timestamp-initialization.html

 

with the right column type (timestamp), and the proper definition, that column could be auto-updated (after you apply the initial update that you are trying) without additional coding.

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.