Answers

Question and Answer:

  Home  MS SQL Server

⟩ How To Sort Query Output in Descending Order in MS SQL Server?

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:

SELECT tag, counts, url, created

FROM ggl_links ORDER BY tag DESC, counts

GO

tab counts url created

SQA 728 rendc.org/sql 2007-05-19

SQA 828 www.winrunner.com 2003-01-01

DEV 120 rendc.org/xml 2006-04-30

DEV 439 www.php.net 2004-01-01

DBA 390 www.mysql.com 2006-01-01

DBA 960 www.oracle.com 2005-01-01

DBA 972 rendc.org 2007-05-19

 205 views

More Questions for you: