Use a Conditional Expression

Data 360 Query Guide, mirrored from developer.salesforce.com: To return a value based on a condition, you can use the `CASE` conditional expression.

markdownreferencev1WYCW-1445guide: data-cloud-query-guidestage: referencetrust: officialsource: developer.salesforce.comservice: data360interface: restinterface: sqlUse a Conditional ExpressionData 360Data CloudData 360 Query Guide

Created 23 Oct 2026 · Modified 23 Oct 2026 · 1 version

Mirror of <https://developer.salesforce.com/docs/data/data-cloud-query-guide/guide/query-conditional-expr.html> (Salesforce, Data 360 Query Guide), read 2026-10-23. Salesforce's own page is the authority; this copy exists because that site refuses non-browser readers.

Use a Conditional Expression

To return a value based on a condition, you can use the CASE conditional expression.

For example, the Account Type ID field of ssot__Account__dlm has the values 'Customer - Direct' and 'Customer - Channel'. You don’t want the 'Customer - ' prefix. Use the CASE conditional expression to return a different value for the Account Type Id field based on the original value. The ELSE expression covers the field values that don’t match the conditions and returns the field value unchanged.

In the condition, you can use all the same operators (=, <, <=, LIKE, BETWEEN, ...) that you can use in WHERE clauses.

!Image 1: Salesforce

  • ### General Information
  • ### Required Cookies
  • ### Functional Cookies
  • ### Advertising Cookies

General Information

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

Always Active

Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.

Cookies Details

Functional Cookies

  • [x] Functional 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.

Cookies Details

Advertising Cookies

  • [x] Advertising Cookies

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.

Cookies Details

Consent Leg.Interest

  • [x] checkbox label label
  • [x] checkbox label label
  • [x] checkbox label label

Clear

  • - [x] checkbox label label

Apply Cancel

Save Settings

Accept All Cookies

![Image 2: Powered by Onetrust](https://onetrust.com/poweredbyonetrust)

Read this document as markdown — the same bytes an agent receives.