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
Rakesh M 20Rakesh M 20 

Hi Everyone,How To Fix This error in batch start method

Query
Select Id,History_Id__c,Candidate_Id__c,Name,New_Value__c,Old_Value__c,Operation_type__c from Candidates_History__c where New_Value__c != Old_Value__c;
    }
Error :
FATAL_ERROR System.QueryException: expecting a colon, found 'Old_Value__c'
Please Help me to fix this issue
 
VinayVinay (Salesforce Developers) 
Try below.
 
Select Id,History_Id__c,Candidate_Id__c,Name,New_Value__c,Old_Value__c,Operation_type__c from Candidates_History__c where New_Value__c !=: Old_Value__c;

Thanks,
Rakesh M 20Rakesh M 20
Thanks Vinay,
But After Changing that one now i'm getting
FATAL_ERROR System.QueryException: Variable does not exist: Old_Value__c
 
VinayVinay (Salesforce Developers) 
Append the variable in the query string
'Select Id,History_Id__c,Candidate_Id__c,Name,New_Value__c,Old_Value__c,Operation_type__c from Candidates_History__c where New_Value__c !=: Old_Value__c';
Thanks