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

PHP MySQL Order by Two Columns


Order by Two Columns

Here's how to order by more than one column. When ordering by more than one column, the second column is only used if the values are identical with the onces in the first column:

SELECT column_name(s)
FROM table_name
ORDER BY column_name1, column_name2

Sort the display by Ascending or Descending Order

If you use the ORDER BY keyword, the sort-order of the recordset is ascending by default (1 before 9 and "a" before "p").

Use the DESC keyword to specify a descending sort-order (9 before 1 and "p" before "a"):

SELECT column_name(s)
FROM table_name
ORDER BY column_name 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