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! 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 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! 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? 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
Archived
This topic is now archived and is closed to further replies.