...

View Full Version : Moving a field up



FlashDance
11-10-2011, 12:27 PM
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.

guelphdad
11-10-2011, 01:56 PM
no it wouldn't be similar to that at all, you would use an ORDER BY in your query.

FlashDance
11-10-2011, 04:31 PM
Cool, so do you know how it can be done?

djm0219
11-10-2011, 04:52 PM
SELECT something FROM table_name ORDER BY `alphabet`

FlashDance
11-10-2011, 04:59 PM
Ah.. I am wanting to make it so they will be alphabetical when I select *.

djm0219
11-10-2011, 06:38 PM
So change my something to * ... the order by is what will make the result set returned alphabetical.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum