function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
lingannalinganna 

SOQL Subquery

Hi all,

I am getting the following error any one please help me to solve

 

expenseList = [Select id,

Name,

Doctors_Met__c,

station__c,

Month_Year_Combination__c,

Chemist_Met__c,

( select id,frommarket__c,tomarket__C,Fare__c from Expense_Fares__r)

from Expense__c ];

 

Error: ManageExpenseStatementController Compile Error: Didn't understand relationship 'Expense_Fares__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. at line 100 column 21 
AquilaDeveloperAquilaDeveloper

Expecting Expense_Fares is plural and Child to  Expense Object 

if not check it once ...

Error msg suggesting to check those things

lingannalinganna

thanks for quick reply

 

I have given plural name only

 

JavedGouryJavedGoury

Hi linganna,

 

you  need to use the child relationship name instead of lookup field API. 

 

Thanks,

Javed

GsajeeshGsajeesh

Hi Linganna

 

try this

 

expenseList = [Select id,

Name,

Doctors_Met__c,

station__c,

Month_Year_Combination__c,

Chemist_Met__c,

( select id,frommarket__c,tomarket__C,Fare__c from Expense_Fares__c)

from Expense__c ];