0

select day_only(createdDate) createdonDate, count(createdDate) numCreated from account group by day_only(createdDate) order by day_only(createdDate) desc

this soql return result count base on day. but i want result count base on month.any way to achieve this soql.

Arjun patel
  • 15
  • 2
  • 8

1 Answers1

2

Use CALENDAR_MONTH function:

select CALENDAR_MONTH (createdDate) createdonDate, count(ID) numCreated from account group by CALENDAR_MONTH (createdDate) order by CALENDAR_MONTH (createdDate) desc
Shimshon Korits
  • 1,189
  • 6
  • 10