Powered by InterCreatives | Site Map
Search:
NewSourceMedia Popular Tutorials: PHP Javascripts Web Hosting
SoftwareTutorials
CATEGORIES
Job Listings
 
Home / PHP / MySQL / Database

PHP Order By Multiple Fields in MySQL

Published by: Alex


You can sort query results in ascending or descending order on one or more of the columns in the result set by using the ASC or DESC keywords with the ORDER BY clause.

Ordering By Two Fields

SELECT * FROM table ORDER BY (field1 / field2) DESC

Ordering By Three Fields

If both field1 and field2 match in more then one row, then use a third to order them by:

SELECT * FROM table ORDER BY (field1 / field2) DESC, field3 DESC


Next PHP Page:
1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  [17]  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32 





Hosting by iPowerWeb.com - 50 Gb for $7.95