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!

Edited by Eiolon
Link to comment
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.