You need to sign in to do that
Don't have an account?
can we use order by in subqueries?
In SOQL I want to display the contacts details....
There is another custom object called "Tester". There is lookup relation between Tester and contact.
my SOQL query is
nlist=[select lastname,firstname,email,phone from contact where id in
(select contact__c from tester where name='abc' order by status__c) ]
I got this error
Compile Error: expecting a right parentheses, found 'order' at line 15 column 1
I have to display the contacts in soring order based on status__c value.
but this field belongs to the object of Tester.
How can I achive this any suggestions.....
Order clause is not supported in sub queries... instead of that why dont you just query on Tester object..someting like..
List<Tester__c> tList = new List<Tester__c>();
tList = [select contact__r.firstname, contact__r.lastname, contact__r.email, contact__r.phone from Tester__c where name = 'abc' order by Status__c];
Thanks for your reply .... I have done what you mentioned but still I am getting this error....
Compile Error: Didn't understand relationship 'contact__r' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name.