---
schema_version: "1"
id: 59df806d7bef1942611f7cceca9a1cf4a4a9dd7fae804aa0b991f48f271673db
title: Use a Conditional Expression
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/data-cloud-query-guide/guides/get-started-dc-sql/query-conditional-expr.md
canonical_url: https://developer.salesforce.com/docs/data/data-cloud-query-guide/guide/query-conditional-expr.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 42c640d96864a08423a65a865d0e6beeb99cf529278c9fef720b62d19c99392d
products:
  - Data 360 Query Guide
  - Data 360 Developer Documentation
---
# 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.

```
SELECT "ssot__AccountTypeId__c",
    CASE
        WHEN "ssot__AccountTypeId__c" = 'Customer - Direct' THEN 'Direct'
        WHEN "ssot__AccountTypeId__c" = 'Customer - Channel' THEN 'Channel'
        ELSE "ssot__AccountTypeId__c"
    END
FROM "ssot__Account__dlm"

```

In the condition, you can use all the same operators (`=, <, <=, LIKE, BETWEEN, ...`) that you can use in `WHERE` clauses.
