You need to sign in to do that
Don't have an account?

Picklist and Group By
Hi everyone,
I got this query:
Select PickListField__c, Name FROM Product2 Group By Name,PickListField__c
if I run this query I got this message:
Field 'PickListField__c' can not be grouped in a query call
If I remove the field from the group by:
Select PickListField__c, Name FROM Product2 Group By Name
Error: Field must be grouped or aggregated: PickListField__c
Any ideas how to solve my problem?
THanks
Hello,
We can not use GROUP By clause without including aggregate functions in our query. GROUP BY is used in conjunction with aggregate functions to group the result-set by one or more columns.
You can use a GROUP BY clause without an aggregated function to query all the distinct values, including null, for an object. Ex:
SELECT commPick__c FROM Contact GROUP BY commPick__c
For further details please refer: http://www.salesforce.com/us/developer/docs/soql_sosl/Content/sforce_api_calls_soql_select_groupby.htm