[SalesForce] unexpected token: ‘2015-07-28’

String query= 'Select Id from Account where isNew__c = true and Start_Date__c <:'+ Date.today() +' or End_Date__c <: '+ Date.today() ';

What I'm I missing in this query? I tried using a date field instead of Date.today() but still get the same error.

Best Answer

Mark was right but you need to wrap the OR in parentheses.

String query = 'SELECT Id FROM Account WHERE isNew__c = true AND (Start_Date__c < TODAY OR End_Date__c < TODAY)';

Related Topic