dflow Posted February 22, 2009 Share Posted February 22, 2009 how can I sql to copy a whole column in the same table? cityID duplicate cityID2? Link to comment https://forums.phpfreaks.com/topic/146411-how-to-copy-a-whole-column-in-the-same-table/ Share on other sites More sharing options...
jackpf Posted February 22, 2009 Share Posted February 22, 2009 while($fetch = mysql_fetch_array($sql)) { $row = $fetch['row']; } Link to comment https://forums.phpfreaks.com/topic/146411-how-to-copy-a-whole-column-in-the-same-table/#findComment-768752 Share on other sites More sharing options...
dflow Posted February 22, 2009 Author Share Posted February 22, 2009 to a new duplicated column in the same table Link to comment https://forums.phpfreaks.com/topic/146411-how-to-copy-a-whole-column-in-the-same-table/#findComment-768783 Share on other sites More sharing options...
jackpf Posted February 23, 2009 Share Posted February 23, 2009 while($fetch = mysql_fetch_array($sql)) { $row = $fetch['row']; mysql_query("INSERT INTO $tb (new_row)VALUES($row)"); } Link to comment https://forums.phpfreaks.com/topic/146411-how-to-copy-a-whole-column-in-the-same-table/#findComment-768791 Share on other sites More sharing options...
sasa Posted February 23, 2009 Share Posted February 23, 2009 UPDATE table_name SET cityID2=cityID WHERE 1 Link to comment https://forums.phpfreaks.com/topic/146411-how-to-copy-a-whole-column-in-the-same-table/#findComment-768906 Share on other sites More sharing options...
jackpf Posted February 23, 2009 Share Posted February 23, 2009 Probably better tbh Link to comment https://forums.phpfreaks.com/topic/146411-how-to-copy-a-whole-column-in-the-same-table/#findComment-768980 Share on other sites More sharing options...
dflow Posted February 23, 2009 Author Share Posted February 23, 2009 you rock Link to comment https://forums.phpfreaks.com/topic/146411-how-to-copy-a-whole-column-in-the-same-table/#findComment-769260 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.