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\'';}