Setting Join Table

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

  • External Table: The dataset associated with the current (source) dataset properties table. Click the drop-down menu in this cell to select a dataset in 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 will be automatically generated.
  • Type: Supports two types: left join and inner join.
    • Left Join: After joining, the number of valid records is the same as that of the source dataset, and the available field values include all field values from the source dataset and all matching field values from the relation.
    • Inner Join: After joining, the number of valid records is the number of records that fully match between the source dataset and the relation, and the available field values are the field values that fully match in 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 adding multiple join conditions for the same external table, double-click the Rule cell of the previous record and set its relationship with the next join condition in the drop-down button. Two rules are provided: AND and OR, as detailed below:
    • 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 use indexed fields as join fields.
  • After adding an external join table to a dataset in a PostGIS data source, when building a query expression, the program will automatically add quotes to table names to resolve the case-sensitive issue of table names within the database.

Related Topics

Building SQL Query

Building SQL Expression Query

Function Description for Building SQL Query

Attribute Query Example

Group Statistics Example