You need to sign in to do that
Don't have an account?
Is there a way to group by the date portion of a datetime field in SOQL for aggregate results?
Guys,
i found following solution but this one shows the result based on days in month.
select day_only(createdDate) createdonDate,
count(createdDate) numCreated
from account
group by day_only(createdDate)
order by day_only(createdDate) desc
But i want result based on month.
Regards,
Vishal Thoriya.
Are you looking for CALENDAR_MONTH instead of DAY_ONLY?
Found it here under "Date Functions"
CALENDAR_MONTH will not work for date time fields. Is there any other work around for date time fields?
I just tried it on a datetime field and it worked.
Also it's demonstrated here
I have tried with following code and it worked for me.
SELECT HOUR_IN_DAY(convertTimezone(CreatedDate)), SUM(Amount)
FROM Opportunity
GROUP BY HOUR_IN_DAY(convertTimezone(CreatedDate))