Setting Join Table

Setting join fields can enhance the information of the current dataset, facilitating SQL queries and the construction of SQL conditions, etc. The description of the Join Attributes dialog is as follows:

  • External Table: The dataset associated with the current (source) dataset properties table. Click the dropdown menu in this cell to select a dataset from the current workspace as the relation.
  • Field: A field in the source dataset properties table that establishes a relationship with the external table through this field.
  • Join Field: A field in the related attribute table that establishes a relationship with the source dataset through this field.
  • Expression: Displays the join condition between the source dataset properties table and the related attribute table. After setting the field, join field, and other information, the join condition is automatically generated.
  • Type: Supports two methods: left join and inner join.
    • Left Join: After joining, the number of valid records is the same as the source dataset. The available field values include all fields from the source dataset and all matching fields from the relation.
    • Inner Join: After joining, the number of valid records is the count of fully matched records between the source dataset and the relation. The available field values include only fully matched fields from both the source dataset and the relation.
      Field Field 2
      1 1A
      2 2B
      3 3C
      4 4D
      Join field Field 3
      1 10
      2 20
      3 30
      5 50
      Join field Field 2 Field 3
      1 1A 10
      2 2B 20
      3 3C 30
      4 4D  
      Join field Field 2 Field 3
      1 1A 10
      2 2B 20
      3 3C 30
           
      Source Dataset Properties Table
      Related Attribute Table
      Left Join Search Result
      Inner Join Search Result
  • Rule: When multiple join conditions are added to the same external table, double-click the Rule cell of a previous record and set its relationship with the next join condition in the dropdown button. Two rules are provided: AND and OR, with details as follows:
    • AND: If multiple join conditions need to be satisfied simultaneously, set the rule to AND.
    • OR: If only one of the join conditions needs to be satisfied, set the rule to OR.

     

Notes:
  • It is recommended that the type of join fields (field, join field) be integer, and fields with indexes should be used as join fields.
  • After adding an external join table to a dataset in a PostGIS data source, the program automatically adds quotes to table names when constructing query expressions to resolve case sensitivity issues within the database.

Related Topics

Building SQL Query

Building SQL Expression Query

Function Description for Building SQL Query

Attribute Query Example

Group Statistics Example