Previous
Previous
 
Next
Next

Comparison and Logical Operators

You use comparison and logical operators to make expressions in much the same way as arithmetic operators. Each operator has a priority that determines its order of evaluation. Operators of equal priority are evaluated left to right, unless parentheses change the order of evaluation. However, the evaluation is halted when the truth value is decided.

Table: Comparison and Logical Operators shows the OLAP DML comparison operators and logical operators (AND, OR, and NOT). It lists the operator, the operations, example, and priority where priority is the order in which that operator is evaluated. Operators of the same priority are evaluated from left to right.

Comparison and Logical Operators

Operator Operation Example Priority

NOT

Returns opposite of BOOLEAN expression

NOT(YES) = NO

1

EQ

Equal to

4 EQ 4 = YES

2

NE

Not equal to

5 NE 2 = YES

2

GT

Greater than

5 GT 7 = NO

2

LT

Less than

5 LT 7 = YES

2

GE

Greater than or equal to

8 GE 8 = YES

2

LE

Less than or equal to

8 LE 9 = YES

2

IN

Is a date in a time period?

'1Jan02' IN myDimension = YES

2

LIKE

Does a text value match a specified text pattern?

'Finance' LIKE '%nan%' = YES

2

AND

Both expressions are true

8 GE 8 AND 5 LT 7 = YES

3

OR

Either expression is true

8 GE 8 OR 5 GT 7 = YES

4