jamiet757 Posted February 22, 2010 Share Posted February 22, 2010 Here is my situation: I have 2 tables, "photos" and "items" I am trying to copy a row from items into photos (the row is "url") There is a row called "id_parent" which is the same number in both tables, so I know I can use that to copy it to the correct row in the new table. Can someone help me with the syntax? I have been trying to figure this out, but I cannot. I just want to run it through phpmyadmin to copy the data to the other table, I only need to do it this one time. Quote Link to comment https://forums.phpfreaks.com/topic/192987-copy-row-from-another-table/ Share on other sites More sharing options...
fenway Posted February 24, 2010 Share Posted February 24, 2010 I'm not sure I follow. Quote Link to comment https://forums.phpfreaks.com/topic/192987-copy-row-from-another-table/#findComment-1017480 Share on other sites More sharing options...
jamiet757 Posted February 25, 2010 Author Share Posted February 25, 2010 Sorry, I am really not sure how to explain it any better. I have two different tables in the same database. I want to copy a row from one to the other. Both tables also contain a row that the value is the same number in both tables, and that is how I want to determine which row gets copied to which row in the new table. (See, now I just made it more complicated!) Quote Link to comment https://forums.phpfreaks.com/topic/192987-copy-row-from-another-table/#findComment-1017785 Share on other sites More sharing options...
fenway Posted February 25, 2010 Share Posted February 25, 2010 Is this a one-time thing? Why are they the same in both tables? Quote Link to comment https://forums.phpfreaks.com/topic/192987-copy-row-from-another-table/#findComment-1018219 Share on other sites More sharing options...
jamiet757 Posted February 25, 2010 Author Share Posted February 25, 2010 Yes this is a one-time thing. The numbers are the same for 1 row in both tables, but there are 3 other rows I want to copy from the first table to the second where the numbers are equal. Quote Link to comment https://forums.phpfreaks.com/topic/192987-copy-row-from-another-table/#findComment-1018251 Share on other sites More sharing options...
fenway Posted February 25, 2010 Share Posted February 25, 2010 Why not a simple UPDATE query? Quote Link to comment https://forums.phpfreaks.com/topic/192987-copy-row-from-another-table/#findComment-1018264 Share on other sites More sharing options...
jamiet757 Posted February 26, 2010 Author Share Posted February 26, 2010 The problem is I am not sure exactly how to do that, I need to know the correct syntax, I can't figure out how to pull the row from one table and then update it in the other. Quote Link to comment https://forums.phpfreaks.com/topic/192987-copy-row-from-another-table/#findComment-1018298 Share on other sites More sharing options...
fenway Posted February 26, 2010 Share Posted February 26, 2010 Just a multi-table update, with the "uid" as the ON clause. Quote Link to comment https://forums.phpfreaks.com/topic/192987-copy-row-from-another-table/#findComment-1018584 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.