• evan34
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies

Hi All,

 

 I have written a query in a batch apex. It was working correctlt until i added

 Date_Opened__c>(today -(5*Average_Sales_Cycle__c)).   It is giving an error  "First error: unexpected token: '(' " when i run the batch apex.

 

Please let me know what is the right way to query a date field (Date_Opened__c) which meet the above criteria.



 

q= 'Select id, name,StageVFlag__c, StageBFlag__c,StageAFlag__c,StageEFlag__c,StageCFlag__c,StageGFlag__c,ownerid, status__c, type, amount,  from opportunity where  (amount>=0.00 and amount<=100000.00) and Date_Opened__c>(today -(5*Average_Sales_Cycle__c)) and type =\'Non-Recurring\'';}

 

Thanks

  • January 25, 2012
  • Like
  • 0