andrew_ww Posted January 7, 2007 Share Posted January 7, 2007 Hello,I'm trying to design quite a complex SQL statement - here what I need to accomplish:I have built a form that is populated with records from mySQL db (table1). This table has the following values:IDvalue1value2value3value4The first thing I need to do is to update whatever values the user puts into these new text boxes (over writing the existing records in the database, this I believe is quite simply using the UPDATE statement. What I also need to do is to send the original value of ID and value 2 into table2, and equally the original value of ID, value3 and value4 in to the table3 along with the current date.I need to do this because these values relate to a state, the history of which over time much be kept (for example on Monday it could status1, then on Wednesday it would change to status3)Any ideas how I can accomplish this ?Thanks. Quote Link to comment Share on other sites More sharing options...
fenway Posted January 7, 2007 Share Posted January 7, 2007 Sounds like you want to issue an INSERT INTO..SELECT WHERE on the existing record first to copy it, and then issue your UPDATE statement. 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.