CASE Statements

Use case statements to express if/then logic. A case statement always has a pair of WHERE and THEN statements. CRM Analytics supports the simple and searched forms of case expressions in a SELECT statement. Case statements have two formats: simple and searched.

A simple statement compares a case expression against a set of expressions. The result is the matched expression.

Here are the results.

CategoryAvailability
FurnitureAvailable
Office SuppliesUnavailable
TechnologyUnknown

The searched form evaluates to a result. A searched statement compares an expression against a series of boolean expressions. If it matches a boolean expression, the result is the corresponding THEN clause. If the expression does not return true for any of the boolean expressions, then the result is the corresponding ELSE clause.

RegionProfitLoss
CentralProfit
EastProfit
SouthProfit
WestProfit