Sql.Net Class Library Documentation

FromClause.Join Method (JoinType, FromTerm, FromTerm, WhereClause)

Joins two tables using on an arbitrary join condition

public void Join(
   JoinType type,
   FromTerm leftTable,
   FromTerm rightTable,
   WhereClause conditions
);

Parameters

type
The type of join to be created.
leftTable
The left table
rightTable
The right table
conditions
Specifies how the join should be performed

Remarks

Use this overload to create complex join conditions. Note that not all WhereClause operators and expressions are supported in joins.

Example

WhereClause condition = new WhereClause(WhereClauseRelationship.Or); condition.Terms.Add(WhereTerm.CreateCompare(SqlExpression.Field("productId", tOrders), SqlExpression.Field("productId", tProducts), CompareOperator.Equal)); condition.Terms.Add(WhereTerm.CreateCompare(SqlExpression.Field("productName", tOrders), SqlExpression.Field("productName", tProducts), CompareOperator.Equal)); query.FromClause.Join(JoinType.Left, tOrders, tProducts, condition);

See Also

FromClause Class | Reeb.SqlOM Namespace | FromClause.Join Overload List