You need to sign in to do that
Don't have an account?
JBabu
How to get the records which belong to current and next year
Hi,
I have a date field called "Schedule_Date__c".
I tried the below query:
select id, name from Opportunity_Division where Schedule_Date__c >= CURRENT_YEAR.
I am getting the error message "unexpected token: CURRENT_YEAR"
Please let me know what the issue is?
Thanks,
Babu.
this works
SELECT Id,Schedule_Date__c FROM Opportunity_Division__c WHERE (Schedule_Date__c >= THIS_YEAR OR Schedule_Date__c >= NEXT_YEAR)
All Answers
you said your query is this
select id, name from Opportunity_Division where Schedule_Date__c >= CURRENT_YEAR
Opportunity_Division is not a standard object. Shouldn't it be select id, name from Opportunity_Division__c where Schedule_Date__c >= CURRENT YEAR
this works
SELECT Id,Schedule_Date__c FROM Opportunity_Division__c WHERE (Schedule_Date__c >= THIS_YEAR OR Schedule_Date__c >= NEXT_YEAR)
Thank you.
it was my typo to mention as "Opportunity_Division"
I thought CURRENT_YEAR would do but thanks for letting me know the usage of THIS_YEAR.