Previous Topic: Literal Value LinkNext Topic: Types of Outer Joins and Disjunctions


Outer Joins

When rows from one table are combined with rows from another table based on an equal comparison of the participating rows' values, the join bypasses rows in all searched tables which have no matching value. The rows not retrieved are not included in the active found set when the RELATED BY clause is used.

When the RELATED BY clause is specified in the query, CA Dataquery performs an inner equijoin, producing output rows by joining rows. To specify that you want the output rows to include rows not retrieved, use an outer join clause in place of the RELATED BY clause.

Syntax Diagram

Following is the syntax diagram for the outer join clause that replaces the RELATED BY clause when rows not joined are wanted in the output.

►►─ FIND ALL TABLE1 ─┬───────────┬─ outer-join-clause ─ 'key1' ─ VIA ─ key2 ──►
                     └─ RECORDS ─┘

 ►─ TO TABLE2 ────────────────────────────────────────────────────────────────►◄
FIND

See FIND Statement.

ALL

(Optional) Use ALL or a number. Defaults to ALL.

TABLE1

Represents the first table to be searched to retrieve data.

RECORDS

Optional.

outer-join-clause

A clause specifying what kinds of unmatched rows are wanted in the output. See Relationship Clauses.

'key1'

Represents the name of a key in the first table that is also found in the second table.

VIA

Optional.

'key2'

Represents the name of a key in the second table that is also found in the first table.

TABLE2

Name of the second table listed in the query.

Tables can be related by comparing a specified value in any column of table1 with values in a specified key or column in another table.