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, 5357👍, 0💬
Popular Posts:
How To Create Nested Tables? - XHTML 1.0 Tutorials - Understanding Tables and Table Cells You can cr...
How To Decrement Dates by 1? - MySQL FAQs - Introduction to SQL Date and Time Handling If you have a...
Can you explain project life cycle ? Figure :- 12.2 Life cycle of a project There are five stages of...
How To Create an Array in PL/SQL? - Oracle DBA FAQ - Introduction to PL/SQL If you want create an ar...
Jack developed a program by using a Map container to hold key/value pairs. He wanted to make a chang...