Adobe COLDFUSION 9 Manual page 444

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Accessing and Using Data
Comparison conditional
This conditional lets you compare an expression against another expression of the same data type (Numeric, String,
Date, or Boolean). You can use it to selectively retrieve only the relevant rows of a recordset.
Syntax
comparison_cond ::= expression [> | >= | <> | != | < | <=] expression
Example
The following example uses a comparison conditional to retrieve only those dogs whose IQ is at least 150:
SELECT dog_name, dog_IQ
FROM Dogs
WHERE dog_IQ >= 150;
BETWEEN conditional
This conditional lets you compare an expression against another expression. You can use it to selectively retrieve only
the relevant rows of a recordset. Like the comparison conditional, the BETWEEN conditional also compares; however,
the BETWEEN conditional compares against a range of values. Therefore, its syntax requires two values, which are
inclusive, a minimum and a maximum. Separate these values with the AND keyword.
Syntax
between_cond ::= expression [NOT] BETWEEN expression AND expression
Example
The following example uses a BETWEEN conditional to retrieve only those dogs whose IQ is between 150 and 165,
inclusive:
SELECT dog_name, dog_IQ
FROM Dogs
WHERE dog_IQ BETWEEN 150 AND 165;
IN conditional
This conditional lets you specify a comma-delimited list of conditions to match. It is similar in function to the OR
conditional. In addition to being more legible when working with long lists, the IN conditional can contain another
SELECT statement.
Syntax
in_cond ::= expression [NOT] IN (expression_list)
Example
The following example uses the IN conditional to retrieve only those dogs who were born at either Ken's Kennels or
Barb's Breeders:
SELECT dog_name, dog_IQ, Kennel_ID
FROM Dogs
WHERE kennel_ID IN ('Kens','Barbs');
LIKE conditional
This conditional lets you perform wildcard searches, in which you compare your data to search patterns. This strategy
differs from other conditionals, such as BETWEEN or IN, because the LIKE conditional compares your data to a value
that is partially unknown.
Last updated 8/5/2010
439

Advertisement

Table of Contents
loading

Table of Contents