It is currently Sat Feb 04, 2012 3:24 pm

All times are UTC + 2 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Sorting with SQL
PostPosted: Sun Jan 24, 1999 9:21 am 
I can't figure out how to use sorting properly with MySQL and PHP. How do I use the "ORDER BY" function? I'm trying as "SELECT somecolumn FROM sometable ORDER BY somecolumn ;"
I know that's not right but I can't find any examples showing how to do it in the MYSQL manual.


Top
  
 
 Post subject: RE: Sorting with SQL
PostPosted: Sun Jan 24, 1999 10:37 am 
you can do something like :

select * from MyTable order by MyColumn

or

select * from MyTable order by MyColumn1,MyColumn2

if you want the sort to be for more than one column.

More info at www.mysql.com

7.11 SELECT syntax
SELECT [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [DISTINCT | ALL]
select_expression,...
[INTO OUTFILE 'file_name' export_options]
[FROM table_references
[WHERE where_definition]
[GROUP BY col_name,...]
[HAVING where_definition]
[ORDER BY {unsigned_integer | col_name} [ASC | DESC] ,...]
[LIMIT [offset,] rows]
[PROCEDURE procedure_name] ]


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 2 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to: