function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Bodhtree1Bodhtree1 

How to write a SOQL Query which gets all the Activities in a particular month?

I had wriiten the query like this to get the events in a particular month like this,but this is producing error.

 

List<Event> activities=new List<Event>;

activities=[select ActivityDate from Event where ActivityDate.month()=5];

 

 

The error produced is :Error: Compile Error: unexpected token: ')'

Pradeep_NavatarPradeep_Navatar

Change your query as SELECT AccountId, ActivityDate FROM Event where CALENDAR_MONTH(ActivityDate) = 5.

 

Did this answer your question? if so, please mark it solved.