8.4.  Element query

A query is a defined SQL SELECT such as a SQL join that can be referenced as if it were a table. A query is defined within a query element. The query element has the same structure (attributes and subelements) as a table element but with some additional subelements and additional attributes on the query element itself to define the query by supplying portions of the SQL SELECT statement.

There is an additional repeating subelement search which occurs after the other subelements as listed in the preceding section on the table element. The search subelement allows the query to contain dynamic parameters. The search subelement has no element content but does have three attributes. The <db:search> tag in a JSP page provides the link between a user-entered value and the query. It also provides the comparison operator used between the column or expression and the user-entered data value. The attributes are listed below.

This is the name of a column in the query. Optional.
This attribute gives the field type. Optional.
This attribute allows an expression to be used rather than a column name. The expression will be given the name provided in the name attribute using the SQL AS operator. Optional.

See Chapter 13, Query Support for more information.