Selects table records matching a Structured Query Language (SQL) expression and writes them to an output table.
The table containing records matching the specified expression that will be written to the output table.
Output TableThe output table containing records from the input table that match the specified expression.
ExpressionAn SQL expression used to select a subset of records.
An SQL expression used to select a subset of records. For more information on SQL syntax, see SQL reference for elements used in query expressions.
arcpy.analysis.TableSelect(in_table, out_table, )
The table containing records matching the specified expression that will be written to the output table.
The output table containing records from the input table that match the specified expression.
where_clauseAn SQL expression used to select a subset of records. For more information on SQL syntax, see SQL reference for elements used in query expressions.
The following Python window script demonstrates how to use the TableSelect function in immediate mode.
import arcpy arcpy.env.workspace = "C:/data" arcpy.analysis.TableSelect("majorrds.shp", "C:/output/majorrdsCl4.shp", '"CLASS" = \'4\'')
TableSelect example 2 (stand-alone script)
The following Python script demonstrates how to use the TableSelect function in a stand-alone script.
# Name: TableSelect_Example2.py # Description: Select class4 roads from the major roads gnatcatcher habitat study area # Import system modules import arcpy # Set workspace arcpy.env.workspace = "C:/data" # Set local variables in_features = "majorrds.shp" out_feature_class = "C:/output/majorrdsCl4.shp" where_clause = '"CLASS" = \'4\'' # Run TableSelect arcpy.analysis.TableSelect(in_features, out_feature_class, where_clause)