Hi,
Is it possible to use the SQL MONTH() and YEAR() functions?
I've been trying variations of this:
prc.SentSummary = EmailHistoryService.newCriteria()
.withProjections(property="MONTH(CreationDate):TheMonth,YEAR(CreationDate):TheYear", count="EmailHistoryID:NumberOfSentEmails", groupproperty = "TheMonth,TheYear")
.order("TheMonth")
.order("TheYear")
.asStruct()
.list();
With the error message: "could not resolve property: MONTH(CreationDate) of: EmailHistory"
The cfquery alternative is:
SELECT COUNT(EmailHistoryID) AS EmailsSent, MONTH(CreationDate) AS TheMonth, YEAR(CreationDate) AS TheYear
FROM tbl_EmailHistory
GROUP BY MONTH(CreationDate), YEAR(CreationDate)
ORDER BY TheYear, TheMonth
.....but I would like to use the CBORM method if possible!