How to use ORDER BY in SOSL?

ORDER BY:
ORDER_BY_IN_SOQL

You can use ORDER BY in a SELECT statement to control the order of the query results. There is no guarantee of the order of results unless you use an ORDER BY clause in a query.

Syntax:

SELECT fieldList
FROM objectType
[WHERE conditionExpression]
[ORDER BY fieldExpression ASC | DESC ? NULLS FIRST | LAST ?]

Above OREDER BY Expression 
ASC or DESC: Specifies whether the results are ordered in ascending (ASC) or descending (DESC) order. Default order is ascending.

NULLS FIRSTS OR NULLS LAST: Orders null records at the beginning (NULLS FIRST) or end (NULLS LAST) of the results. By default, null values are sorted first.

Example: 
The following query returns a query result with Account records in alphabetical order by first name, sorted in descending order, with accounts that have null names appearing last.

SELECT Name
FROM Account
ORDER BY Name DESC NULLS LAST

Before Using ORDER BY go through this points:
1. Sorting is case insensitive.
2. ORDER BY is compatible with relationship query syntax.
3. Multiple column sorting is supported, by listing more than one fieldExpression clause.
4. Sort order is determined by current user locale. For English locales, Salesforce uses a sorting mechanism based on the UTF-8 values of the character data. For Asian locales, Salesforce uses a linguistic sorting mechanism based on the ISO 14651 and Unicode 3.2 standards.

ORDER BY Limits:
1. These data types are not supported: multi-select picklist, rich text area, long text area, encrypted (if enabled), and data category group reference (if Salesforce Knowledge is enabled).
2. Phone data does not include any special formatting when sorting, for example, non-numeric characters such as dash or parentheses are included in the sorting.
3. Picklist sorting is defined by the picklist sort determined during setup.

COMMENTS

Name

Apex Apex Default Methods Apex Methods Apex_Collections Apps Batch Apex Books CRM eBooks Data Import Wizard Data Management DataLoader Dataloader.io Difference Between Error in Salesforce FAQ's FAQ's-Apex FAQ's-Apps FAQ's-CRM FAQ's-Data loader FAQ's-SOQL & SOSL FAQ'S-Triggers FAQ's-User Profile & Security FAQ's-VF Force.com Explorer Force.com Ide Formulas & Functions Integration Interview Questions Only Latest_Updates Limits&Best Practices Online-Training Reports and Dashboards Salesforce Deployment Salesforce Realtime Examples On Development Salesforce Realtime Task On Admin Salesforce Realtime Tasks Salesforce Realtime Tasks- Apex Salesforce Training Salesforce1 Mobile Sites SOQL Spring'14 Release Triggers User Profile & Security VF Tags VisualForce Winter'14 Release Wizard for Accounts/Contacts Workbench Workflows and Approvals
false
ltr
item
Sfdc Gurukul- All in one place for salesforce and force.com step by step tutorial for beginners: How to use ORDER BY in SOSL?
How to use ORDER BY in SOSL?
how to use order by in soql,how to use order by in salesforce,soql order by,soql order by desc,soql sort by date,soql query order by,salesforce query order by,salesforce soql query order by,order by salesforce soql,salesforce soql order by desc
http://2.bp.blogspot.com/-p8BWrUrpMio/UlLYad7hSdI/AAAAAAAABCk/f5rsx-8HyE0/s1600/ORDER_BY_IN_SOQL.jpeg
http://2.bp.blogspot.com/-p8BWrUrpMio/UlLYad7hSdI/AAAAAAAABCk/f5rsx-8HyE0/s72-c/ORDER_BY_IN_SOQL.jpeg
Sfdc Gurukul- All in one place for salesforce and force.com step by step tutorial for beginners
http://sfdcgurukul.blogspot.in/2013/10/how-to-use-order-by-in-sosl.html
http://sfdcgurukul.blogspot.in/
http://sfdcgurukul.blogspot.com/
http://sfdcgurukul.blogspot.com/2013/10/how-to-use-order-by-in-sosl.html
true
4199533888133360731
UTF-8
Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy