The ORDER BY clause sorts the rows returned in the rowset according to a specified set of criteria.
ORDER BY Sort_Column1 [ ASC | DESC ][,Sort_Column2 [ ASC | DESC ] ] ...
Sort_Column | Specifies the name of the column to be sorted or the ordinal position of the column. |
ASC | DESC | Specifies the sorting order, either ascending (ASC) or descending (DESC). If you do not specify the sort order, the columns are sorted in ascending order. However, if a column is explicitly marked ascending or descending, succeeding columns will use that same sort order until another column in the list is explicitly marked in the other order. |
In the following example:
SELECT Col1, Col2, Col3, Col4, Col5 FROM SCOPE() WHERE Col1 > 10 ORDER BY Col1, Col2 DESC, Col3, Col4, Col5 ASC
The following example is equivalent to the previous example, but refers to the columns by their ordinal position.
SELECT Col1, Col2, Col3, Col4, Col5 FROM SCOPE() WHERE Col1 > 10 ORDER BY 1, 2 DESC, 3, 4, 5 ASC
© 1997 by Microsoft Corporation. All rights reserved.
file: /Techref/language/asp/ix/ixseob.htm, 3KB, , updated: 1997/8/15 14:47, local time: 2024/11/23 15:15,
18.117.75.218:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://massmind.org/techref/language/asp/ix/ixseob.htm"> SQL Access to Index Server Data: ORDER BY Clause</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to massmind.org! |
.