Logician Posted November 10, 2011 Share Posted November 10, 2011 I have a column called alphabet, with the fields B, A, C, D: alphabet -------- B A C D I am wanting to know how I can go about moving A up to where B is, so: Alphabet -------- A B C D There are other fields from other columns on this same line: A | Active | Always This procedure would be similar to: ALTER TABLE (table) CHANGE COLUMN (column) (new column name) (type) AFTER (column);, but for a field instead of a column. Quote Link to comment https://forums.phpfreaks.com/topic/250861-moving-a-field-up/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 10, 2011 Share Posted November 10, 2011 In database terminology, there are rows and there are columns/fields. Columns and fields are the same thing and are interchangeable names that refer to the columns/fields that exist in a table. Think of rows going down the page and columns/fields going across the page. Also, you don't alter your table structure to get your columns/fields or rows to be in a particular order, you do that in your query. I'm guessing that your example actually refers to the value in different rows. To get a result set to be in any particular order, you would use an ORDER BY some_column term in your query. Quote Link to comment https://forums.phpfreaks.com/topic/250861-moving-a-field-up/#findComment-1287041 Share on other sites More sharing options...
Logician Posted November 10, 2011 Author Share Posted November 10, 2011 Cool, so do you know how it can be done? Quote Link to comment https://forums.phpfreaks.com/topic/250861-moving-a-field-up/#findComment-1287083 Share on other sites More sharing options...
Logician Posted November 10, 2011 Author Share Posted November 10, 2011 When I: "select * from (table);", they are not alphabetical. I am wanting the table alphabetical when I select *. Quote Link to comment https://forums.phpfreaks.com/topic/250861-moving-a-field-up/#findComment-1287093 Share on other sites More sharing options...
The Little Guy Posted November 10, 2011 Share Posted November 10, 2011 select * from table order by alphabet Quote Link to comment https://forums.phpfreaks.com/topic/250861-moving-a-field-up/#findComment-1287157 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.