potato_chip Posted June 2, 2009 Share Posted June 2, 2009 What I want to do is: first: copy one record from a table with certain creteria second: just update two fileds third: insert this new record into the same table This talbe has more than 100 fields, can somebody please show me how to write the query? Thank you very much! Quote Link to comment https://forums.phpfreaks.com/topic/160674-copy-and-insert-a-row/ Share on other sites More sharing options...
Ken2k7 Posted June 2, 2009 Share Posted June 2, 2009 Your table has 100 fields? Wow, read up on DB normalization. 1 & 3 - read up on SQL INSERT...SELECT - http://dev.mysql.com/doc/refman/5.0/en/insert-select.html 2 - use SQL UPDATE Quote Link to comment https://forums.phpfreaks.com/topic/160674-copy-and-insert-a-row/#findComment-847941 Share on other sites More sharing options...
potato_chip Posted June 2, 2009 Author Share Posted June 2, 2009 (yeah, I know it sounds ridiculous that the table has more than 100 fields, but this is a very complicated system and that's how the thing works here.) My problem is: the filed I want to update is part of the key. If you could give me a sample example, that will be great! Quote Link to comment https://forums.phpfreaks.com/topic/160674-copy-and-insert-a-row/#findComment-847956 Share on other sites More sharing options...
fenway Posted June 6, 2009 Share Posted June 6, 2009 Why is that a problem? Quote Link to comment https://forums.phpfreaks.com/topic/160674-copy-and-insert-a-row/#findComment-850502 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.