You need to sign in to do that
Don't have an account?

SOQL Order by Limit
If you have a SOQL statement with ORDER BY and a LIMIT 100 clause, which executes first? Does it order all records and then take the first 100 records or does it do the LIMIT first and then ORDER BY?
hello rdclk23
If you have a SOQL query like that thenit will order all records first, after that will apply the limits.
Hope this help!!!
Regards
VIMAL SRIVASTAVA
I agree to Vimal. It will query based on the Order then limit it.
http://www.salesforce.com/us/developer/docs/soql_sosl/Content/sforce_api_calls_soql_select.htm
Try for this process.
List<Account> accList=new List<Account>();
accList==[SELECT id,
Name
FROM Account
ORDER BY Name ASC
LIMIT 1000
];
Thanks
Akshay