Skip to main content
GameDev.net gamedev.net
🔒 Locked

[web] MySql Order-By

Started by Cygnus_X Jul 30, 2006 at 2:02 PM 1 replies 700+ views
Original Post
Cygnus_X
Cygnus_X
Is there a way to order by column name in mysql? For example, if I have a table with Columns C, A, B, can I make a statment in the query such that the columns will be arranged A, B, C in use with mysql_field_name()? I can technically get all the column names, dump them into an array, then use sort(), but I'd like to avoid that if possible.
evolutional
evolutional
select A, B, C from Table order by C
markr
markr
ORDER BY sorts the rows not the columns in the results.

The columns come out in the order you specify them in the SELECT clause.

Mark

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.