yarub Posted August 1, 2006 Share Posted August 1, 2006 How do I move fields with rows already in it? I'm combining to tables and the fields don't match up.Table 1A B [b]C D[/b] E FTable 2A B [b]D C[/b] E FIt basically looks like that. There are far too many rows to change each one individually. How can I just switch the two fields around? Link to comment https://forums.phpfreaks.com/topic/16264-moving-some-fields-around/ Share on other sites More sharing options...
fenway Posted August 2, 2006 Share Posted August 2, 2006 I don't think you can actually do this without adding a new column in the right place, copying over the data, and then dropping the old column. But why bother? You can combine two tables however you'd like. Link to comment https://forums.phpfreaks.com/topic/16264-moving-some-fields-around/#findComment-67833 Share on other sites More sharing options...
yarub Posted August 2, 2006 Author Share Posted August 2, 2006 How can I do that? I've been trying to do that, but it would appear I do not know how. I can't just drop the id column and add the other database to the the current one. The fields don't match up. So could you explain to me as to how I could o that? Link to comment https://forums.phpfreaks.com/topic/16264-moving-some-fields-around/#findComment-68153 Share on other sites More sharing options...
fenway Posted August 2, 2006 Share Posted August 2, 2006 That depends what you mean by "combine"... Link to comment https://forums.phpfreaks.com/topic/16264-moving-some-fields-around/#findComment-68198 Share on other sites More sharing options...
yarub Posted August 3, 2006 Author Share Posted August 3, 2006 Table 1A B C D E FTable 2A B D C E FI just want to take all of the rows from Table 2 and put them at the end of Table 1 via the auto increment thinger. Link to comment https://forums.phpfreaks.com/topic/16264-moving-some-fields-around/#findComment-68372 Share on other sites More sharing options...
fenway Posted August 3, 2006 Share Posted August 3, 2006 You can use "INSERT INTO t1 ( a, b, c, d, e, f ) SELECT a, b, c, d, e, f FROM t2"; how are you currently doing it? Link to comment https://forums.phpfreaks.com/topic/16264-moving-some-fields-around/#findComment-68556 Share on other sites More sharing options...
yarub Posted August 4, 2006 Author Share Posted August 4, 2006 How would that work though? The fields do not line up. Link to comment https://forums.phpfreaks.com/topic/16264-moving-some-fields-around/#findComment-68980 Share on other sites More sharing options...
fenway Posted August 4, 2006 Share Posted August 4, 2006 So? You can SELECT fields in any order you choose, and INSERT fields in any order as well. Link to comment https://forums.phpfreaks.com/topic/16264-moving-some-fields-around/#findComment-68983 Share on other sites More sharing options...
yarub Posted August 7, 2006 Author Share Posted August 7, 2006 :o I did not know that. Link to comment https://forums.phpfreaks.com/topic/16264-moving-some-fields-around/#findComment-70473 Share on other sites More sharing options...
fenway Posted August 7, 2006 Share Posted August 7, 2006 Yup... SELECT takes a field list, however you want them back; and insert statement take a column list for that very reason as well. Link to comment https://forums.phpfreaks.com/topic/16264-moving-some-fields-around/#findComment-70477 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.