SharkBait Posted April 23, 2008 Share Posted April 23, 2008 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. Quote Link to comment Share on other sites More sharing options...
fenway Posted April 23, 2008 Share Posted April 23, 2008 Single-table UPDATE assignments are generally evaluated from left to right... so that should be ok. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.