Previous Topic: Putting Rows in OrderNext Topic: A simple comparison


Retrieving Selected Rows

Use WHERE

You can retrieve selected rows from a table by specifying selection criteria in the WHERE clause. A WHERE clause contains one or more comparison expressions. A comparison expression compares one value to another value. The simplest comparison expression compares column values to a constant. If the comparison expression is true, CA OLQ selects the row for the report.

Within the WHERE clause, you can select rows by using these symbols and keywords:

Expression

Meaning

Comparison operators (for example, = and <=)

Compares each value in a column to another value.

AND and OR

Connects comparison expressions. AND is true if all the comparisons are true. OR is true if any of the comparisons is true.

IN

Compares a column's values to a list of values. The expression is true if the value in the column equals one of the listed values.

NOT

Negates the comparison expression. That is, if the comparison expression is true, NOT returns a value of false so the row is not selected.

BETWEEN

Compares each value in a column to a specified range, including the starting and ending range values.

LIKE

Compares a character string to a mask (that is, pattern).

Arithmetic expression

Compares a value in a column to the result of an arithmetic expression.

Built-in function

Compares each value in a column to a value calculated by a predefined function.

CA OLQ does not support NULL, an ANSI-standard keyword, for this release.