Re: [PHP-DB] changing sort order of fields in MySQL From: Miles Thompson (milesthompson <email protected>)
Date: 10/13/00

Irfan,

In relational databases the order of the fields does not matter, as they can be
addressed by name. If you want a different sort order you specify it in your
select statement. For example, with fields intentionally mixed up ...

select birthdate, city, firstname, street, lastname, favourite_food from
personnel order by lastname, firstname;

returns the fields sorted by lastname and firstname. Where these fields are
located in the database table is irrelevant.

Regards - Miles Thompson

Irfan Uygur wrote:

> I know this sounds stupid, but i'm currently designing a MySQL dbase that's
> going to work mith my PHP code, and as the program
> gets more and more complex, i have to add new fields to MySQL. I'm using
> MyAdmin in order to speed up the db stuff and while listing the fields
> MyAdmin sorts the fields' creation date. For ex if i have name,sex,
> location, tel, fax fields and then if a later add a field "age"
> it lists the fields as name,sex, location, tel, fax , age but it would be
> more easier for me to follow-up if listed the fields as
> name, sex, age, location, tel, fax. So is there a way to change the order of
> appearance of fields ?
>
> I looked up the MySQL ref but couldn't find any relevant info about this.
> Thanks in advance.
>
> Irfan Uygur
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe <email protected>
> For additional commands, e-mail: php-db-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>