Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Sort Output in Descending Order
How To Sort Output in Descending Order? - MySQL FAQs - SQL SELECT Query Statements with GROUP BY
✍: FYIcenter.com
If you want to sort a column in descending order, you can specify the DESC keyword in the ORDER BY clause. The following SELECT statement first sorts the "tag" in descending order, then sorts the "counts" in ascending order:
mysql> SELECT tag, counts, url, DATE(created) FROM fyi_links ORDER BY tag DESC, counts; +------+--------+-------------------+---------------+ | tag | counts | url | DATE(created) | +------+--------+-------------------+---------------+ | SQA | 6 | sqa.fyicenter.com | 2006-07-01 | | SQA | 8 | www.winrunner.com | 2003-01-01 | | DEV | 4 | dev.fyicenter.com | 2006-04-30 | | DEV | 4 | www.php.net | 2004-01-01 | | DBA | 1 | www.mysql.com | 2006-01-01 | | DBA | 3 | dba.fyicenter.com | 2006-07-01 | | DBA | 7 | www.oracle.com | 2005-01-01 | +------+--------+-------------------+---------------+ 7 rows in set (0.01 sec)
2007-05-11, 5447👍, 0💬
Popular Posts:
.NET INTERVIEW QUESTIONS - Where do you specify session state mode in ASP.NET ? The following code e...
Managed Code and Unmanaged Code related ASP.NET - How do you hide Public .NET Classes and other publ...
How To Retrieve Input Values for Checkboxes Properly? - PHP Script Tips - Processing Web Forms If mu...
How can you raise custom errors from stored procedure ? The RAISERROR statement is used to produce a...
Can Two Forms Be Nested? - XHTML 1.0 Tutorials - Understanding Forms and Input Fields Can two forms ...