Specifies a join condition for data sources joined with a JOIN keyword.
This form of the ON clause is required with outer joins, but is optional with inner joins specified with the JOIN keyword syntax. The ON clause defines a condition for the join.
When used with outer joins, the condition must consist of one or more simple equality comparisons, each of which compare a column in one data source with a column in the other data source. When multiple column comparisons are specified, they are separated by the AND keyword.
When used with inner joins, the condition can be any valid Boolean expression that evaluates to true or false.
All column references in the ON clause must refer to data sources specified in the FROM clause. This form of the ON clause is used in a Query statement, Database statement, or Remote Procedure statement.
Outer join conditions are limited to comparisons between two or more columns in the two data sources of the join. The comparison cannot specify a literal value, or compare two columns in the same data source.
The ON clause cannot be used with joins specified using the FROM Clause: Database and Remote Subquery Syntax or FROM Clause: Comma-Separated Syntax. Join conditions for such joins are specified using the WHERE clause.
Database Statement
Query Statement
Remote Procedure Statement
FROM
WHERE
The following example publishes information about the symbol and price of a stock when an inquiry for the stock arrives on the Inquiry stream:
INSERT INTO OutStream SELECT Trades.Symbol, Trades.Price FROM Inquiry JOIN Trades ON Inquiry.Symbol = Trades.Symbol;