Show Navigation | Hide Navigation
You are here:
Mapping and visualization > Navigating and interacting with maps > Interacting with maps > Selecting features and graphics

Using Select By Attributes

Release 9.3
Last modified April 24, 2009
E-mail This Topic Printable Version Give Us Feedback

Print all topics in : "Selecting features and graphics"


Related Topics

About selecting features by attributes

Note: This topic was updated for 9.3.1.

Structured Query Language (SQL) is a powerful language you use to define one or more criteria that can consist of attributes, operators, and calculations. For example, imagine you have a map of customers and want to find those who spent more than $50,000 with you last year and whose business type is a restaurant. You would select the customers with this expression: Sales > 50000 AND Business_type = 'Restaurant'.

When you search with SQL expressions, you can select features or table records in any data format supported by ArcMap. However, you format expressions differently depending on the format of the data you are querying.

The Select By Attributes dialog box allows you to select features on a given layer using a SQL expression.
Learn more about building SQL expressions for different formats


Field display options on the Select By Attributes dialog box

A menu on the Select By Attributes dialog box lets you choose how fields will be listed. This menu is accessed by clicking a small control to the right of the fields list or by right-clicking the fields list. This menu gives you the option of listing fields with their field aliases instead of their underlying field names. When you choose this option, the fields list respects field alias properties when you are working with layers and tables. Seeing field aliases in the list can be helpful because you can use field aliases to make cryptic field names more user-friendly or long ArcSDE field names more manageable.

The Show Field Aliases option is turned off by default. Choosing to show aliases on this dialog box has no effect on the expression syntax. Field aliases are not shown or supported in the expression itself. If you double-click a field shown with its alias, it will still be added into the expression with its actual name and the required [ ] field delimiters. In the example shown below, the field list is showing aliases and the field with the alias Depth last recorded (cm) has been added into the expression, where you see the field's actual name, not its alias:

Field display options in the Select By Attributes dialog box


Another option on this menu lets you choose how the fields are sorted in the list. By default, the fields are still listed in their original order in the data source. Choosing Sort Ascending or Sort Descending can make it easier to quickly locate the field you want.

The sorting and field name options you choose remain in effect whenever you use this dialog box or others that offer the same options such as the Field Calculator, all Query Builder dialog boxes, and the Label Expression dialog box.


How to select features by attributes

  1. Click Selection on the Main menu and click Select By Attributes.
  2. Click the Layer drop-down arrow and click the layer containing the features you want to select.
  3. Click the Method drop-down arrow and click a selection method.
  4. Double-click a field to add the field name to the expression box.
  5. If you want to sort the list of fields or see the fields by their aliases, click the small button on the top right of the fields list.
  6. Click an operator to add it to the expression.
  7. Click Get Unique Values to see the values for the selected field.
  8. Double-click a value to add it to the expression.
  9. Click the Verify button to see if you are using proper syntax or if the criteria you've entered will select any features.
  10. Click Apply.
  11. The status bar at the bottom of the ArcMap window tells you how many features are selected.
  12. Use the Clear button to empty the expression box.
  13. Use the Save and Load buttons respectively to save your current query as a file or load an existing one.
  14. The files used to save the queries have a .exp extension but can be edited with any text editor. Only the content of the expression box is saved in the file, not the complete expression.
  15. Click Close when you are finished selecting features.

Tips

  • For guidelines on how to build SQL expressions for different data formats, see About building a SQL expression.
  • You can also click OK instead of Apply if you want to execute the query and close the dialog box in one click.
  • You can specify the layers you want to be able to select from by clicking the Selection tab on the table of contents and checking the layers containing features you want to select.
  • The list of layers organizes layers into groups if any group or composite layers are present.
  • Type a value into the Go To box to quickly navigate a list of unique values.
  • Fields that have been turned off for the layer or table you are working with are not listed on the Select By Attributes dialog box. Field visibility is set on the Fields tab of the Layer Properties or Table Properties dialog box or from the table window.
  • A menu on the Select By Attributes dialog box lets you choose how fields will be listed. This menu is accessed by clicking a small control to the right of the fields list, or by right-clicking the fields list. This menu gives you the option of listing fields with their field aliases instead of their underlying field names. Field aliases are not shown or supported in the expression itself. If you double-click a field shown with its alias, it will still be added into the expression with its actual name and the required [ ] field delimiters.
  • The Select By Attributes dialog box and Select By Location dialog box both have check boxes that let you choose to only show selectable layers. If you check this box, ArcMap remembers this setting between sessions. This setting also applies to ArcGlobe and ArcScene (if you have the ArcGIS 3D Analyst extension). In this way, you can check this box once and it will be checked whenever you use this dialog box.

Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.
Copyright © Environmental Systems Research Institute, Inc.