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

System.QueryException: Didn't understand relationship '
Hi,
I am trying to write a query but I am getting the error:
System.QueryException: Didn't understand relationship 'Opportunity_Contact__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
I have a junction object between Opportunities and Contacts. II need to get all the contacts that are associated with the Opportunity's account. Inmy junction object I have created a formula field to get the Opportunity's account. Below is my query:
String soql = 'select name, id,(select id, Account__c, AccountId__c from Opportunity_Contact__r) from Contact';
I also wrote another query but i am getting error: Unexpected token "T2.Account". Query is:
String soql = 'select name from Contact AS T1,Opportunity AS T2 where T1.Account=T2.Account';
Pls suggest how can I retreive the contacts.
Usually you'd have to use the plural for related objects - try: