B0b Posted June 3, 2010 Share Posted June 3, 2010 Hi everyone, I'm trying to copy a column from a table to another while removing duplicate entries then add 3 other columns and fill one of them with numbers from 1 to X -> that's what I'm unable to do. Here's my goal: Table 1: 1 bob1 2 bob2 3 bob2 4 bob3 5 bob4 Table 2: 1 bob1 jack marc 2 bob2 frank stu 3 bob3 some dude 4 bob4 foo bar Here's what I got: <?php $new = 'tmp_' . $original; mysql_query( "CREATE TABLE $new AS SELECT DISTINCT email FROM $original" ); I'm confused as to how to add the first column. Thanks! Link to comment https://forums.phpfreaks.com/topic/203704-select-distinct/ Share on other sites More sharing options...
B0b Posted June 3, 2010 Author Share Posted June 3, 2010 Let's be more specific: I know the column may be added using: <?php mysql_query( "ALTER TABLE $tmpName ADD column type" ); But I don't know how I may fill it since I may not refer to anything using WHERE. Link to comment https://forums.phpfreaks.com/topic/203704-select-distinct/#findComment-1066987 Share on other sites More sharing options...
B0b Posted June 3, 2010 Author Share Posted June 3, 2010 Bump :-\ Link to comment https://forums.phpfreaks.com/topic/203704-select-distinct/#findComment-1067405 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.