You need to sign in to do that
Don't have an account?
Jeff McKinnis 4
Query to combine results of 3 different fields that contain the same values (picklist) into a single list and sum number of records
Asking for assistance on query syntax to return a single list of values from 3 fields. These fields all use the same picklist values. End goal would be to query and retrive all the non-blank values, combine into a single list and sum the # of records associated with the values. The query below works, but does not combine into a single list.
SELECT Category_for_Added_Query_1__c,Category_for_Added_Query_2__c,Category_for_Added_Query_3__c,
SUM(of_Records__c) Total
FROM Audit_Record__c
WHERE Audit_Formal_Name__c = 'audit name'
AND
(Category_for_Added_Query_1__c != null
OR Category_for_Added_Query_2__c != null
OR Category_for_Added_Query_3__c != null)
GROUP BY Category_for_Added_Query_1__c,Category_for_Added_Query_2__c,Category_for_Added_Query_3__c
Sample Results:
SELECT Category_for_Added_Query_1__c,Category_for_Added_Query_2__c,Category_for_Added_Query_3__c,
SUM(of_Records__c) Total
FROM Audit_Record__c
WHERE Audit_Formal_Name__c = 'audit name'
AND
(Category_for_Added_Query_1__c != null
OR Category_for_Added_Query_2__c != null
OR Category_for_Added_Query_3__c != null)
GROUP BY Category_for_Added_Query_1__c,Category_for_Added_Query_2__c,Category_for_Added_Query_3__c
Sample Results: