Jump to content

Updating Fields In A Row


SharkBait

Recommended Posts

I've never thought about it but is it possible to update a single row to take one value in one field and add it to another field?

 

IE

 

id |  received_date  | meh  | original_date 

--+-----------------+-------+--------

1  |  2007-05-05      |          |

--+-----------------+-------+--------

 

to make it look like

 

id |  received_date  | meh    | original_date 

--+-----------------+-------+--------

1  |  2008-04-23      |          | 2007-05-05

--+-----------------+-------+--------

 

 

So something like UPDATE table SET field3 = field1, field1 = NOW() WHERE id = 1 or would I need to do 2 updates because of replacing the value in field1?

 

What I am looking to do is move a datetime from one field, into another (save the original date) and then in the field1 insert the current date.

 

One location receives the item and the received_date gets set, then the product might be shipped to another location but we want to be able to track what the original receiving date was so that we can check to see how long we have a particular item for before we shipping it back.

 

 

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.