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? Quote Link to comment 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. Quote Link to comment 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? Quote Link to comment Share on other sites More sharing options...
fenway Posted August 2, 2006 Share Posted August 2, 2006 That depends what you mean by "combine"... Quote Link to comment 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. Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
yarub Posted August 7, 2006 Author Share Posted August 7, 2006 :o I did not know that. Quote Link to comment 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. Quote Link to comment 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.