You need to sign in to do that
Don't have an account?
Matt Folger
Ascending Order for a User-Generated SOQL query
I've got a front-end, back-end page that takes user input and creates and then displays a SOQL query. In this the date order is displaying descending. Can we get it to display in ascending order? Better yet, if they could click the title of the display column to order it by that critieria that would be even better.
SELECT name, Inquiry__c, Inquiry_Status__c, Product__c, PO__c, Vendor__c, Inquiry_Date__c FROM Vencorr__c WHERE Inquiry_Status__c like '%Original%' AND Inquiry_Date__c = LAST_N_DAYS: 180 ORDER BY Inquiry_Date__c ASC NULLS LAST LIMIT 1000
All Answers
http://www.salesforce.com/us/developer/docs/dbcom_soql_sosl/index_Left.htm#StartTopic=Content/sforce_api_calls_soql_select_orderby.htm
ERROR
Error:
unexpected token: WHERE
That comes from my SOQL query string looking like this
SOQL: SELECT name, Inquiry__c, Inquiry_Status__c, Product__c, PO__c, Vendor__c, Inquiry_Date__c FROM Vencorr__c ORDER BY Inquiry_Date__c ASC NULLS LAST WHERE Inquiry_Status__c like '%Original%' AND Inquiry_Date__c = LAST_N_DAYS: 180 LIMIT 1000
SELECT name, Inquiry__c, Inquiry_Status__c, Product__c, PO__c, Vendor__c, Inquiry_Date__c FROM Vencorr__c WHERE Inquiry_Status__c like '%Original%' AND Inquiry_Date__c = LAST_N_DAYS: 180 ORDER BY Inquiry_Date__c ASC NULLS LAST LIMIT 1000