In Salesforce SOQL, querying multi-select picklist fields requires special syntax because these fields can hold multiple semicolon-separated values stored in a single field. Standard equality operators (=) do not work correctly with multi-select picklist fields.
Instead, Salesforce provides the INCLUDES and EXCLUDES keywords for filtering multi-select picklist values. Within the filter values:
To find records where both 'AAA' and 'BBB' are selected in the multi-select picklist field, use a semicolon between the values inside single quotes with the INCLUDES keyword. For example, to query the Account object's MSP1__c multi-select picklist field for records where both AAA and BBB are selected:
Query structure: SELECT id, name FROM Account WHERE MSP1__c INCLUDES ('AAA;BBB')
This returns records where the field contains both AAA and BBB as selected values.
To find records where ('AAA' AND 'BBB' are both selected) OR ('CCC' is selected alone), combine a semicolon (for AND) and a comma (for OR). For example:
Query structure: SELECT id, name FROM Account WHERE MSP1__c INCLUDES('AAA;BBB','CCC')
This returns records that have (AAA and BBB both selected) or (CCC selected).
To find records where 'AAA', 'BBB', or 'CCC' is selected (any one of the three), separate each value with a comma. For example:
Query structure: SELECT id, name FROM Account WHERE MSP1__c INCLUDES('AAA', 'BBB','CCC')
This returns records where the field contains AAA selected, or BBB selected, or CCC selected.
000386734

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.