Select Layer By Attribute (Data Management)

This ArcGIS 2.8 documentation has been archived and is no longer updated. Content and links may be outdated. See the latest documentation.

Summary

Adds, updates, or removes a selection based on an attribute query.

Usage

  • If the input is a feature class or dataset path, this tool will automatically create and return a new layer with the result of the tool applied.

  • If the input's data source is a feature service, it is recommended that the underlying ArcGIS Server use standardized SQL queries.

  • If a definition query is present on the input, only the features or rows matching the definition query will be used in the selection.

  • When using is Above Average and is Below Average queries, the AVG function will always execute on the source data, even if the input layer is a subset of source data.

  • The number of selected records will be listed in the geoprocessing history under Parameters > Count. Additionally, the Get Count tool can be used to count the number of selected records. From Python, the number of selected records can also be accessed from the tool's Result object.

Parameters

LabelExplanationData Type
Input Rows

The data to which the selection will be applied.

Table View; Raster Layer; Mosaic Layer
Selection type
(Optional)

Specifies how the selection will be applied and what to do if a selection already exists.

  • New selectionThe resulting selection replaces the current selection. This is the default.
  • Add to the current selectionThe resulting selection is added to the current selection if one exists. If no selection exists, this is the same as the new selection option.
  • Remove from the current selectionThe resulting selection is removed from the current selection. If no selection exists, this option has no effect.
  • Select subset from the current selectionThe resulting selection is combined with the current selection. Only records that are common to both remain selected.
  • Switch the current selectionThe selection is switched. All records that were selected are removed from the current selection, and all records that were not selected are added to the current selection. The Expression parameter (where_clause in Python) is ignored when this option is specified.
  • Clear the current selectionThe selection is cleared or removed. The Expression parameter (where_clause in Python) is ignored when this option is specified.
String
Expression
(Optional)

An SQL expression used to select a subset of records.

SQL Expression
Invert Where Clause
(Optional)

Specifies whether the expression will be used as is, or the opposite of the expression will be used.

  • Unchecked—The query will be used as is. This is the default.
  • Checked—The opposite of the query will be used. If the Selection Type parameter is used, the reversal of the selection occurs before it is combined with existing selections.
Boolean

Derived Output

LabelExplanationData Type
Updated Layer Or Table View

The updated inputs with selections applied.

Table View; Raster Layer; Feature Layer
Count

The number of selected records.

Long

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics