1

I have a soql query in a batch process where I want to filter on dates. I currently get the error: First error: unexpected token: Start_Date__c. How do I advoid this?

Apex

global Database.QueryLocator start(Database.BatchableContext bc) {
        return Database.getQueryLocator(

    'SELECT Id, Start_Date__c, End_Date__c, Account__c, New_Address__r.BillingStreet__c, New_Address__r.BillingPostalCode__c' +
    'New_Address__r.BillingCity__c, New_Address__r.BillingState__c, Recordtype FROM New_Account_Address__c' +
    'Account__r.BillingStreet' +
    'WHERE Start_Date__c < TODAY AND End_Date__c > TODAY'
        );
    }
3

It looks like there is no space currently between the end of Account__r.BillingStreet and the beginning of WHERE...

Try adding a space there.

2
  • 1
    +1; there's a couple other syntax errors that will appear when that's fixed (missing space, missing comma, incorrect field name Recordtype) – David Reed Dec 13 '19 at 16:31
  • @DavidReed Thanks I just realized that – Thomas Dec 13 '19 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.