I need to provide statistics to the users in my VF Page, showing the total of records they own where the status is New, In progress, Approved, Pending, Converted
I have tried the below query in my custom controller but I don't know how to combine different status's and I am getting an error
Save error: Grouped field should not be aggregated: Status__c*
Request_for_System_Change__c
is the name of the custom object
public list<Request_for_System_Change__c> getStats(){
RETURN [
SELECT
Count(Status__c)
, MAX(Request_Title__c)
FROM
Request_for_System_Change__c
WHERE
ownerid=:userInfo.getUserID()
GROUP BY
Status__c
HAVING
Status__c='New'
ORDER by
MAX(LastModifiedDate) DESC
];
}
Also, what is the best way to return this information - is a <L:ist>
the way to go?