--- title: "Joins" slug: "core-abstract-join" updated: 2026-05-19T12:20:05Z published: 2026-05-19T12:21:32Z canonical: "docs.lobstersoftware.com/core-abstract-join" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # Joins The following types are available for the explicit configuration of [Joins](?c1761033603730#): - [Entity join](/v1/docs/en/core-entity-join) - [Mapped Join](/v1/docs/en/core-mapped-join) - [Attribute join](/v1/docs/en/core-attribute-join) - [Singular attribute join](/v1/docs/en/core-singular-attribute-join) - [Typed attribute join](/v1/docs/en/core-typed-attribute-join) > [!NOTE] > **NOTE:** > > - [Joins](/v1/docs/en/core-abstract-join) are typically created in the configuration of a search (or a [Sub search](/v1/docs/en/core-sub-search) oder [Subsearch projection](/v1/docs/en/core-sub-select-projection)) at a parent level in order to use the alias name defined in the further configuration of the search. > - If required, [Joins](/v1/docs/en/core-abstract-join) can also be used to create a [Chained projection](/v1/docs/en/core-chained-projection) (see there for examples). The alias names used are not valid outside the projection. > - [Joins](/v1/docs/en/core-abstract-join) can also be used in the context of data grid settings to include additional data in the [Tuple search](/v1/docs/en/core-tuple-search) for an overview. A "Joins" tab is available for this in the context of the column configuration. Although the [Joins](/v1/docs/en/core-abstract-join) configured in this way are formally related to a specific column of the data grid, they can be addressed in the context of the entire data grid definition via the assigned alias name. On the other hand, it is important to ensure that there are no different definitions in different columns for the same alias name. --- ## Background All [Search types](/v1/docs/en/core-abstract-search) in **Lobster Data Platform/Orchestration** require the selection of an entity type (in the "Entity" property), which defines the primary data source for the "Search". The selection of the entity determines which database table the database query generated for the search in the `FROM` section of the `SELECT` statement directly refers to. The `FROM` section of a `SELECT` statement can also contain several `JOIN` sections in order to include the results of other table accesses in the search. Within each `JOIN` section, the complex ON condition determines which criteria must be met for data records from the `JOIN` table to be considered "related" to a specific data record from the `FROM` table. ### Example diagram | A CANDIDATES table evaluates in the LEVEL column the knowledge of candidates identified in the NAME column in relation to the language named in the LANGUAGE column: \| "CANDIDATES" table \| \| --- \| \| **NAME** \| **LANGUAGE** \| **LEVEL** \| \| Agneta \| `en` \| 4 \| \| Agneta \| `sv` \| 5 \| \| Bruno \| `en` \| 1 \| \| Bruno \| `it` \| 5 \| \| Charles \| `en` \| 5 \| \| Charles \| `fr` \| 2 \| \| Diego \| `en` \| 3 \| \| Diego \| `es` \| 5 \| \| Emilia \| `de` \| 3 \| \| Emilia \| `en` \| 2 \| \| Emilia \| `it` \| 5 \| \| Florence \| `fr` \| 5 \| | A further TASKS table defines the required "English language skills" (`EN_LEVEL`) for the tasks named in the TASK column: \| "TASKS" table \| \| --- \| \| **TASK** \| **EN_LEVEL** \| \| Service Desk \| 4 \| \| Pool supervisor \| 3 \| \| Housekeeping \| 2 \| \| Security \| 2 \| | | --- | --- | | "CANDIDATES" table | | **NAME** | **LANGUAGE** | **LEVEL** | | Agneta | `en` | 4 | | Agneta | `sv` | 5 | | Bruno | `en` | 1 | | Bruno | `it` | 5 | | Charles | `en` | 5 | | Charles | `fr` | 2 | | Diego | `en` | 3 | | Diego | `es` | 5 | | Emilia | `de` | 3 | | Emilia | `en` | 2 | | Emilia | `it` | 5 | | Florence | `fr` | 5 | | "TASKS" table | | **TASK** | **EN_LEVEL** | | Service Desk | 4 | | Pool supervisor | 3 | | Housekeeping | 2 | | Security | 2 | The following slightly simplified `SELECT` statement aims to form an intersection between TASKS and suitable CANDIDATES: **SELECT** `TASK, NAME` **FROM** TASKS **INNER JOIN** CANDIDATES **ON** `((LANGUAGE = "en") AND (LEVEL >= EN_LEVEL))` | Result: \| TASK \| NAME \| \| --- \| --- \| \| Service Desk \| Agneta \| \| Service Desk \| Charles \| \| Pool supervisor \| Agneta \| \| Pool supervisor \| Charles \| \| Pool supervisor \| Diego \| \| Housekeeping \| Agneta \| \| Housekeeping \| Charles \| \| Housekeeping \| Diego \| \| Housekeeping \| Emilia \| \| Security \| Agneta \| \| ... \| ... \| | The `SELECT` statement creates a "cross product" `TASKS x CANDIDATES` and returns only those combinations of TASK (from `TASKS`) and(from `CANDIDATES`) as "matches" (=result lines) for which sufficient knowledge of English is available (**ON** condition). An **INNER JOIN** is explicitly used here because the result should be exactly the intersection of CANDIDATES and TASKS defined by the **ON** condition. - In contrast to this, a **LEFT JOIN** would also list TASKS in the result for which none of the CANDIDATES is sufficiently qualified. The NAME column would then remain empty. - `CANDIDATES` unsuitable for all `TASKS` (here: "Bruno" and "Florence") cannot be found in either the *INNER JOIN* or the *LEFT JOIN*. These would only be listed via **RIGHT JOIN** with an empty TASK column. **IMPORTANT:** In the context of a search in **Lobster Data Platform/Orchestration** , in many cases a **RIGHT JOIN** cannot "work" in the same way as it would directly on a database. By default, explicitly *configured* [Joins](?c1761033603730#) (as well as any implicitly *generated* ones; see below for details) are executed as a **LEFT JOIN**. | | --- | --- | | TASK | NAME | | Service Desk | Agneta | | Service Desk | Charles | | Pool supervisor | Agneta | | Pool supervisor | Charles | | Pool supervisor | Diego | | Housekeeping | Agneta | | Housekeeping | Charles | | Housekeeping | Diego | | Housekeeping | Emilia | | Security | Agneta | | ... | ... | ### Implicitly generated joins When executing a "search", at least one `SELECT` statement is generated based on the configuration of the search and – if this succeeds without error – transferred to the database. Data storage for an entity type often extends across several database tables, the relationship between which is then also more or less strictly "regulated" on the database side, depending on the data model for the entity. If the relationship between an entity and the data managed in a "detail table" is sufficiently binding, the relevant relations are automatically "resolved" when accessing detail properties in [Projections](/v1/docs/en/core-i-search-projection) , without the need to explicitly configure [Joins](/v1/docs/en/core-abstract-join). --- **NOTE:** If different [Projections](/v1/docs/en/core-i-search-projection) imply exactly the same join, this is generally not executed redundantly on the database side, but is used jointly within the generated `SELECT` statement. --- | Example: [Users](/v1/docs/en/base-user) ←(1 : 1)→ [Addresses](/v1/docs/en/base-address) | | --- | | ![images/download/attachments/167858318/image-2024-1-17_16-35-56-version-1-modificationdate-1705505757058-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-1-22_8-36-9-version-1-modificationdate-1705908970109-api-v2.png) | In a [Tuple search](/v1/docs/en/core-tuple-search) for [Users](/v1/docs/en/base-user) a [Property projection](/v1/docs/en/core-property-projection) accesses the "Name" address property (`address.name1`). This search returns the desired result without any further precautions, although only the "username" (`username`) can be found directly in the database table for [Users](/v1/docs/en/base-user) ( base_user ). Access to the "address" requires a **LEFT JOIN** to the database table base_address , which contains all addresses known in the system. This **LEFT JOIN** including the **ON** condition relevant to the context, is generated automatically when the database query is executed. | | The following `SELECT` statement is generated for this simple [Tuple search](/v1/docs/en/core-tuple-search): --- **SELECT** `username, name1` **FROM** base_user **LEFT JOIN** base_address **ON** `(id = address_id)` --- - The `base_user` table for [Users](/v1/docs/en/base-user) refers to the field `id` of the table `base_address` for [Addresses](/v1/docs/en/base-address) defined as the *primary key* via the foreign key `address_id` property.. - The **ON** condition requires the foreign key and *primary key* to match so that each user is assigned "their" address. - The **LEFT JOIN** ensures that [Users](/v1/docs/en/base-user) without an assigned address can also appear in the result. | | Example [Users](/v1/docs/en/base-user) ←(1 : n) → IDs of assigned [Roles](/v1/docs/en/base-role) | | --- | | ![images/download/attachments/167858318/image-2024-1-17_17-27-46-version-1-modificationdate-1705508866380-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-1-22_8-36-44-version-1-modificationdate-1705909004281-api-v2.png) | In a [Tuple search](/v1/docs/en/core-tuple-search) for [Users](/v1/docs/en/base-user) a [Property projection](/v1/docs/en/core-property-projection) accesses the "Roles" (`roles`) list field, which can contain several ID values of [Roles](/v1/docs/en/base-role) as a value. This search returns the desired result without any further precautions, although only the "username" (`username`) can be found directly in the database table for [Users](/v1/docs/en/base-user) ( base_user ). So that several role IDs can be assigned to the same user, a specific detail table ( base_user_roles ) is required in which different role IDs ( role_id ) can be combined with the same foreign key ( user_id ) on the [Users](/v1/docs/en/base-user) table. Access to the "roles" of a user again requires a **LEFT JOIN**. | | The following `SELECT` statement is generated for this simple [Tuple search](/v1/docs/en/core-tuple-search): --- **SELECT** `username, role_id` **FROM** base_user **LEFT JOIN** base_user_roles **ON** `(id = user_id)` --- **NOTE:** Each role ID could in turn be interpreted as a foreign key for a data record in the table for [Roles](/v1/docs/en/base-role) (`base_role`), so that there is actually an (m : n) relation ([Users](/v1/docs/en/base-user) **←(m : n) →** [Roles](/v1/docs/en/base-role)). However, this cannot be enforced here by a [Property projection](/v1/docs/en/core-property-projection) such as `roles.roleName`, because [Roles](/v1/docs/en/base-role) are only referenced in the data model for [Users](/v1/docs/en/base-user) and are not *embedded* or *contained* in the data model.. | | Example: [Users](/v1/docs/en/base-user) ←1 : 1→ [Addresses](/v1/docs/en/base-address) ~ [Typed attribute projection](/v1/docs/en/core-typed-attribute-projection) | | --- | | ![images/download/attachments/167858318/image-2024-1-18_10-24-5-version-1-modificationdate-1705569845585-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-1-22_8-37-40-version-1-modificationdate-1705909060685-api-v2.png) | In a [Tuple search](/v1/docs/en/core-tuple-search) for [Users](/v1/docs/en/base-user) a [Typed attribute projection](/v1/docs/en/core-typed-attribute-projection) accesses the flag attribute for the address with the (sub)type `VIP` to return its "flag value" (`flagValue`). This search returns the desired result without any further precautions, although only the "username" (`username`) can be found directly in the database table for [Users](/v1/docs/en/base-user) ( base_user ). As explained in the first example above, accessing a field of the address already implies a **LEFT JOIN** to the `base_address` table. As can be seen in the screenshot on the left, our [Typed attribute projection](/v1/docs/en/core-typed-attribute-projection) explicitly refers to the **Attribute owner path** `address`. By default, flag attributes for [Users](/v1/docs/en/base-user) are not supported at all. On the database side, the implementation of an attribute type for an owner requires a separate database table in which the attribute properties for this owner-attribute type combination are stored. Access to attribute values therefore always requires at least one implicit join. The [Projections](/v1/docs/en/core-i-search-projection) for attributes only simplify access on the surface. However, this does not eliminate the need to look up the specific detail tables in the database. **NOTE:** In special cases, it may be necessary to dispense with the convenience of [Projections](/v1/docs/en/core-i-search-projection) for attributes and instead set up explicit [Joins](/v1/docs/en/core-abstract-join) for accessing attribute values. | | The following `SELECT` statement is generated for this simple [Tuple search](/v1/docs/en/core-tuple-search): --- **SELECT** `username, flag_value` **FROM** base_user **LEFT JOIN** `base_address` **ON** `( id = address_id)` **LEFT JOIN** base_address_flag_attribute **ON** `((id = address_id) AND (flag_type = VIP))` | | **NOTE:** In the **ON** condition for the second **LEFT JOIN**, the id from the green address table (base_address) is used as the compare value for the address_id column in the red marked attribute table ( base_address_flag_attribute ) However, as can be seen in the **ON** condition for the first **LEFT JOIN**, this must match the *foreign key* address_id in the [Users](/v1/docs/en/base-user) table (base_user) marked in blue. Therefore, it is possible to completely dispense with the first **LEFT JOIN** to the address if the *foreign key* address_id is compared directly with the address_id column of the attribute. This abbreviation can only be enforced in an explicit join. The implicit join will always follow the internally predefined schema (**Entity → Attribute owner path → Attribute**) if an **Attribute owner path** is specified that differs from the entity in the **FROM** section. | ### Explicitly defined joins By explicitly defining **Joins**, additional data sources can be included in a search so that they are available for the definition of [Projections](/v1/docs/en/core-i-search-projection). - All [Search types](/v1/docs/en/core-abstract-search) can use [Projections](/v1/docs/en/core-i-search-projection) on [Joins](/v1/docs/en/core-abstract-join) to define [Restrictions](/v1/docs/en/core-i-search-restriction). **NOTE:** An `INNER JOIN` can also restrict the search if necessary, without there being any restrictions at the main level of the search. - In a [Tuple search](/v1/docs/en/core-tuple-search) or [CSV search](/v1/docs/en/core-csv-search) data assigned via [Joins](/v1/docs/en/core-abstract-join) can serve as [Projections](/v1/docs/en/core-i-search-projection) for Output columns and Group by's. - In data grid settings, data from [Joins](/v1/docs/en/core-abstract-join) can also be used in Restriction projections (for filtering) or Sorting projections (for sorting). - Explicit [Joins](/v1/docs/en/core-abstract-join) may only be required as an intermediate step in order to enable projections for key values in the `ON` condition of further [Joins](/v1/docs/en/core-abstract-join). | All [Joins](/v1/docs/en/core-abstract-join) have the parameters shown on the right: - The **Join alias** (with the default value `a`) defines the name by which the structure from the Join can be addressed in the associated search. This usually also applies to [Projections](/v1/docs/en/core-i-search-projection) für [Restrictions](/v1/docs/en/core-i-search-restriction) in the **On** condition. - A **Join type** ("Inner", "Left", "Right") must be selected in the [Combobox](/v1/docs/en/fre-combo-box-vo). By default, "Left" is preset, as this **Join type** covers the typical use case – the inclusion of any existing data records in the context of the search. The other types ("Inner" and "Right") are often only of limited use in the context of a search or can only be used in special cases. - The **Optional** option is selected by default. This means that the configured join is only effectively used in database queries at runtime if [Projections](/v1/docs/en/core-i-search-projection) are actually created in the search configuration that access the alias name. | ![images/download/attachments/167858318/image-2024-1-18_14-3-41-version-1-modificationdate-1705583021831-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-1-22_8-38-32-version-1-modificationdate-1705909113128-api-v2.png) | | --- | --- | | The configuration of an **On** condition is always optional. For all [Joins](/v1/docs/en/core-abstract-join) except the [Entity join](/v1/docs/en/core-entity-join) the context already implies a condition for the join: - A [Mapped Join](/v1/docs/en/core-mapped-join) assigns data records based on the property selection for the "Join property" parameter. - A [Attribute join](/v1/docs/en/core-attribute-join), [Singular attribute join](/v1/docs/en/core-singular-attribute-join) or [Typed attribute join](/v1/docs/en/core-typed-attribute-join) provides attribute data of the entity of the search or a different entity defined via the "Attribute owner path" in the context of the search. An explicitly configured **On** condition is always combined with any applicable *implicit* condition in an AND junction. In this case, the join only adds data records for which both the *implicit* and the *explicit* condition apply as passed. | > [!CAUTION] > **CAUTION****:** > > An important restriction for the definition of an explicit **On** condition is that it must not refer to a projection with a path to a property that would imply another join. > > What sounds quite complicated can be clearly understood using the following example: > > - A search for [Users](/v1/docs/en/base-user) uses a [Entity join](/v1/docs/en/core-entity-join) to include the data of all [Companies/Clients](/v1/docs/en/base-company-account) in the search whose ID is specified in the "Companies" (`companies`) list field of a user account. > - A secondary condition is that only company accounts whose address field "Country" (`address.countryCode`) refers to the [Country](/v1/docs/en/core-country) "Switzerland" (`CH`) should be taken into account. | **NOTE:** The configuration shown on the right is not completely nonsensical, but "just off the mark". It is intended to demonstrate a common mistake when configuring an **On** condition that contains a secondary condition. --- - The [Entity join](/v1/docs/en/core-entity-join) refers to the "Company account" entity type as an **Entity**. - The text abbreviation `cmp` was arbitrarily selected as the **Join alias**. - "Inner" is selected as the **Join type**. In conjunction with unchecking the **Optional** option, this should force the parent search to only list [Users](/v1/docs/en/base-user) for whom at least one company account exists that fulfills the following **On** condition: - The first [Field restriction](/v1/docs/en/core-property-search) requires the company ID (`cmp.id`) to match an entry in the "Companies" (`companies`) list field of the user account. - The second [Field restriction](/v1/docs/en/core-property-search) is intended to ensure that the location of an assigned company is in Switzerland: - The "Country" address property of the company (`cmp.address.countryCode`) is addressed as the check value (left). - The static compare value (right) is provided via a [Enumeration](/v1/docs/en/core-dynamic-enum-value-editor) value resolver. --- This configuration returns an error message when the search is executed: --- ```plaintext A join within a on condition is not possible ``` --- The "Join" to which the error message refers is not the explicitly created [Entity join](/v1/docs/en/core-entity-join) to the company account. However, it is problematic that the "Country" property is addressed in the address of the company account. The path selected in the **Property** parameter implies a join to the address so that its "Country" property can be evaluated. What is not difficult in the projection for an output column, for example, is not possible in the context of an **On** condition. In order for the restriction for the country of the company account to be implemented effectively, the company address must be explicitly included in the search by means of an additional join. | ![images/download/attachments/167858318/image-2024-1-19_18-13-7-version-1-modificationdate-1705684387852-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-1-22_8-43-24-version-1-modificationdate-1705909404600-api-v2.png) | | --- | --- | | **The secondary bindings for the address of a company included by a join can only be effectively implemented here by an additional join for the address:** | | The [Entity join](/v1/docs/en/core-entity-join) described above can be customized as follows: - The **Join type** has been changed to "Left". - The **Optional** option has been unchecked. - The second [Field restriction](/v1/docs/en/core-property-search) has been removed from the **On** condition. In the form shown on the right, the [Entity join](/v1/docs/en/core-entity-join) first binds all [Companies/Clients](/v1/docs/en/base-company-account) that are assigned in the `companies` property of a user. A [Mapped Join](/v1/docs/en/core-mapped-join) has been added below, which refers to the "address" property of a company provided by the first join (`cmp.address`) as a **Join Property**: - The name `cmpAddress` was arbitrarily assigned as the **Join Alias** here. - The **Join Type** "Inner" in conjunction with the unchecked **Optional** option ensures that the parent search returns exactly those [Users](/v1/docs/en/base-user) as matches for which the On condition is fulfilled, which checks whether the "Country" property of the company address (`cmpAddress.countryCode`) refers to the [Country](/v1/docs/en/core-country) "Switzerland" ( - `CH`) | ![images/download/attachments/167858318/image-2024-1-19_18-51-6-version-1-modificationdate-1705686666395-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-1-22_9-48-27-version-1-modificationdate-1705913307834-api-v2.png) |