function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
Hey guys,
I want to get data for a table like this:
Owner Name | # Leads Status 1 | # Leads Status 2 | # Leads Status 3 | # Leads Status 4
ABC 1 3 1 4
DEF 3 2 4 2
Can I get the required Information in 1 SOQL statement?
Thanks,
Josh
Yes you can get it
[select owner,status from lead group by owner]
CLK, thank you for the hint!
My final statement is:
select owner.name , status , count(id) from lead group by owner.name, status order by owner.name ASC, status ASC
Well, I was a little too fast. It's not the solution, I'm looking for...
My SOQL result should look like this:
Name | Status | Count
N1 S1 0
N1 S2 5
N1 S3 3
N2 S1 1
N2 S2 0
N2 S3 2
How can I realize that?
Thanks!
sample code :
AggregateResult[] groupedResults= [SELECT CampaignId, AVG(Amount)FROM OpportunityGROUP BY CampaignId];for (AggregateResult ar : groupedResults) {System.debug('Campaign ID' + ar.get('CampaignId'));System.debug('Average amount' + ar.get('expr0'));}
Yes you can get it
[select owner,status from lead group by owner]
CLK, thank you for the hint!
My final statement is:
Well, I was a little too fast. It's not the solution, I'm looking for...
My SOQL result should look like this:
Name | Status | Count
N1 S1 0
N1 S2 5
N1 S3 3
N2 S1 1
N2 S2 0
N2 S3 2
How can I realize that?
Thanks!
sample code :
AggregateResult[] groupedResults
= [SELECT CampaignId, AVG(Amount)
FROM Opportunity
GROUP BY CampaignId];
for (AggregateResult ar : groupedResults) {
System.debug('Campaign ID' + ar.get('CampaignId'));
System.debug('Average amount' + ar.get('expr0'));
}