function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jeff McKinnis 4Jeff 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:
Sample results