WHERE Statement

WHERE statement is optional. The WHERE statement is used to select only certain rows for the results table. Processing of the WHERE statement is done against the aggregate data rows, before any summarization is performed.

For example:

WHERE search-condition

where search-condition specifies one or more search conditions that should be applied to the aggregate data rows to determine if a particular row should be selected for the results table. Multiple search conditions are joined by the logical operators AND and OR. Each search condition uses this format:

element relation comparand

where:

element is an element of the aggregate.

relation is one of these comparison operators: = (equal), != or <> (not equal), > (greater than), >= (greater than or equal), < (less than), or <= (less than or equal).

comparand is either a numeric constant, a character string literal enclosed in apostrophes, or another element of the aggregate with identical format, units, and scale attributes to the element on the left side of the comparison. An asterisk matches any single character. The values for date and time constants are expressed as character string literals in 'yyyy-mm-dd' (year, month, and day) and 'hh:mm:ss.fraction' (hours, minutes, and seconds) formats, respectively. The value for a date-time constant is expressed as 'yyyy-mm-ddThh:mm:ss.fraction'. The value for a hexadecimal constant is expressed as X 'hex-digits'.