You need to sign in to do that
Don't have an account?
sakthidharan Ambayiram
how to write a single query for counting the records based on different conditions?
For example i want to count the records in opportunity for the conditions like type='New customer' and StageName='Prospecting' in a single query?
plz reply back with your answers, thanks in Advance
plz reply back with your answers, thanks in Advance
This is not feasible to perform using a single query however you can write a SOQL query and create your own aggregators based for the conditions. Refer below example
Do post here if you have further questions.
Happy Coding!!
All Answers
Sorry for this issue you are facing.
May I suggest you please refer to below link from the forums community with a similar discussion which might help you further.
- https://developer.salesforce.com/forums/?id=906F00000008xf1IAA
Please let us know if this helps.Kindly mark this as solved if the reply was helpful.
Thanks,
Nagendra
thanks for your reply, the above mentioned link discussed about multiple conditions for counting the records but i wanted to do a seperate count for multiple conditions
For Example :
I want to perform the below in a single query
1. To count the opportunity records with type as 'New customer'
2. To count the opportunity records with StageName as 'Prospecting'
Is it possible to achieve the above two cases in a same query ?
This is not feasible to perform using a single query however you can write a SOQL query and create your own aggregators based for the conditions. Refer below example
Do post here if you have further questions.
Happy Coding!!