Click to Rate and Give Feedback
MSDN
MSDN Library
Office Development
SDK Documentation
General Reference
SQL Syntax
 ORDER BY Clause

  Switch on low bandwidth view
Community Content
In this section
Statistics Annotations (0)
ORDER BY Clause in Enterprise Search SQL Syntax

Sorts the query results based on the value of one or more columns that you specify.

…ORDER BY <column> [<direction>] [,<column> [<direction>]] 

The column specifier must be a valid column. You can use the column specifier to refer to columns by the order that they appear in the query. The first column in the query is numbered 1.

You can include more than one column in the ORDER BY clause, separated by using commas.

The optional direction specifier can be either ASC for ascending (low to high) or DESC for descending (high to low). If you do not provide a direction specifier, the default, ASC, is used. If you specify more than one column, but do not specify all directions, the direction you specify last is applied to each column until you explicitly change the direction.

For example, in the following ORDER BY clause, the columns A, B, C, and G are sorted in ascending order, while columns D, E, and F are sorted in descending order.

…ORDER BY A ASC, B, C, D DESC, E, F, G ASC

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
When using RANK in the ORDER BY clause no other properties should be used      mcnga1   |   Edit   |   Show History
"When using RANK in the ORDER BY clause of a SharePoint Search query, no other properties should be used"
http://support.microsoft.com/kb/970830

Symptom: When using RANK in the ORDER BY clause of a SharePoint Search query only the first ORDER BY column is used in the results.

Cause: RANK is a special property that is ranked in the full text index and hence cannot be used with other managed properties.

Resolution: Do not use multiple properties in conjunction with the RANK property.

Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker