jonnewton Posted January 4, 2008 Share Posted January 4, 2008 Is there an easy way to duplicate or copy a MySQL field in phpMyAdmin other than just copying/pasting the data from one field to another? I don't see any buttons that do that. The help docs say you can do it, but I can't find where it says how. Any help greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/84511-copy-a-field-with-phpmyadmin/ Share on other sites More sharing options...
fenway Posted January 4, 2008 Share Posted January 4, 2008 To what end/ Quote Link to comment https://forums.phpfreaks.com/topic/84511-copy-a-field-with-phpmyadmin/#findComment-430625 Share on other sites More sharing options...
jonnewton Posted January 4, 2008 Author Share Posted January 4, 2008 I realize I mis-labeled this subject. What I want to do is duplicate a record within a table. Any help and so forth... Quote Link to comment https://forums.phpfreaks.com/topic/84511-copy-a-field-with-phpmyadmin/#findComment-430821 Share on other sites More sharing options...
revraz Posted January 5, 2008 Share Posted January 5, 2008 You could export it and import it. Quote Link to comment https://forums.phpfreaks.com/topic/84511-copy-a-field-with-phpmyadmin/#findComment-430875 Share on other sites More sharing options...
fenway Posted January 5, 2008 Share Posted January 5, 2008 I realize I mis-labeled this subject. What I want to do is duplicate a record within a table. Any help and so forth... Because...? Quote Link to comment https://forums.phpfreaks.com/topic/84511-copy-a-field-with-phpmyadmin/#findComment-430926 Share on other sites More sharing options...
jonnewton Posted January 5, 2008 Author Share Posted January 5, 2008 I have complex records who share a lot of the same data. It would be great to set up one record, duplicate it, then just replace the data in the few fields that are different. I did export a field, for which there is a button in phpMyAdmin. I used default settings. When I tried to import it, it gave me an error message that I was trying to import a duplicate table. I opened the export into a text editor and copied the INSERT portion into the SQL box in the original table. I had to change the data in the primary key field to NULL (it's an auto-increment int field), but then it added the record no problemo. I probably could have exported with some other format, but... This isn't that bad, but it would be great to just be able to hit a "Duplicate Record" button--guessing there isn't one? Quote Link to comment https://forums.phpfreaks.com/topic/84511-copy-a-field-with-phpmyadmin/#findComment-431149 Share on other sites More sharing options...
fenway Posted January 5, 2008 Share Posted January 5, 2008 You could use INSERT INTO... SELECT WHERE... to "duplicate"... just copy whatever values to want in the select, and add string values for anything else, e.g.: INSERT INTO yourTable ( col1, col2, col3, col4) SELECT 'newcol1value', col2, col3, 'newcol4value' FROM yourTable WHERE uid = <the-source-record's-uid> Quote Link to comment https://forums.phpfreaks.com/topic/84511-copy-a-field-with-phpmyadmin/#findComment-431162 Share on other sites More sharing options...
jonnewton Posted January 6, 2008 Author Share Posted January 6, 2008 oh, that's interesting, I will try that! Quote Link to comment https://forums.phpfreaks.com/topic/84511-copy-a-field-with-phpmyadmin/#findComment-431552 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.