Join Field (Data Management)

License Level:BasicStandardAdvanced

Summary

Joins the contents of a table to another table based on a common attribute field. The input table is updated to contain the fields from the join table. You can select which fields from the join table will be added to the input table.

The records in the Input Table are matched to the records in the Join Table based on the values of Input Join Field and the Output Join Field. Optionally, only desired fields can be selected from the Join Table and appended to the Input Table during the join.

Illustration

The join field tool

Usage

Syntax

JoinField_management (in_data, in_field, join_table, join_field, {fields})
ParameterExplanationData Type
in_data

The table or feature class to which the join table will be joined.

Mosaic Layer; Raster Catalog Layer; Raster Layer; Table View
in_field

The field in the input table on which the join will be based.

Field
join_table

The table to be joined to the input table.

Mosaic Layer; Raster Catalog Layer; Raster Layer; Table View
join_field

The field in the join table that contains the values on which the join will be based.

Field
fields
[fields,...]
(Optional)

The fields from the join table to be included in the join.

Field

Code Sample

JoinField example 1 (Python window)

The following Python window script demonstrates how to use the JoinField function in immediate mode.

import arcpy
from arcpy import env
env.workspace = "C:/data/data.gdb"
arcpy.JoinField_management("zion_park", "zonecode", "zion_zoning", "zonecode", ["land_use","land_cover"])
JoinField example 2 (stand-alone Python script)

This stand-alone Python script shows the JoinField function used to join a table to a feature class and only include two of the table's fields in the join.

# PermanentJoin.py
# Purpose: Join two fields from a table to a feature class 

# Import system modules
import arcpy
from arcpy import env

# Set the current workspace 
env.workspace = "c:/data/data.gdb"

# Set the local parameters
inFeatures = "zion_park"
joinField = "zonecode"
joinTable = "zion_zoning"
fieldList = ["land_use", "land_cover"]

# Join two feature classes by the zonecode field and only carry 
# over the land use and land cover fields
arcpy.JoinField_management (inFeatures, joinField, joinTable, joinField, fieldList)

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
11/18/2013