有没有办法按SOQL中的日期时间字段的日期部分进行分组

时间:2013-05-20 15:29:45

标签: salesforce apex-code soql

选择day_only(createdDate)createdonDate,     count(createdDate)numCreated     从帐户     group by day_only(createdDate)     按day_only(createdDate)desc

排序

此soql返回结果计数基于日。 但我希望结果计数基于month.A实现这个soql的方法。

1 个答案:

答案 0 :(得分:2)

使用CALENDAR_MONTH功能:

select CALENDAR_MONTH (createdDate) createdonDate, count(ID) numCreated from account group by CALENDAR_MONTH (createdDate) order by CALENDAR_MONTH (createdDate) desc
相关问题