Skip to main content
All docs
V23.2

SelectQueryFluentBuilder.Join(String, String, SqlJoinType, String) Method

Joins two tables. Allows you to specify a table alias, the join operation type, and a column name by which the tables should be joined.

Namespace: DevExpress.DataAccess.Sql

Assembly: DevExpress.DataAccess.v23.2.dll

NuGet Packages: DevExpress.DataAccess, DevExpress.Win.PivotGrid, DevExpress.Win.TreeMap

Declaration

public SelectQueryFluentBuilder Join(
    string tableName,
    string tableAlias,
    SqlJoinType joinType,
    string keyColumnName
)

Parameters

Name Type Description
tableName String

The name of the table with which the current table of the query builder should be joined.

tableAlias String

A table alias.

joinType SqlJoinType

The join operation type.

keyColumnName String

The name of a column that is used to join the tables.

Returns

Type Description
SelectQueryFluentBuilder

A query builder that contains the join operation result.

Example

using DevExpress.DataAccess.Sql;
// ...
var query = SelectQueryFluentBuilder
    .AddTable("Categories")
    .SelectColumns("CategoryName", "CategoryID")
    .Join(tableName: "Products",
        tableAlias: "Products1",
        joinType: SqlJoinType.FullOuter,
        keyColumnName: "CategoryID")
    .SelectColumn("ProductName")
    .Join(tableName: "Products",
        joinType: SqlJoinType.Inner,
        keyColumnName: "ProductName")
    .SelectColumn("UnitPrice")
    .Build("Categories");
See Also