Adding a table to the SQL statement

The standard ArcMap Query Builder allows you to construct a WHERE clause to filter or select the rows of a feature class or table based on attributes contained within it. With the Visual Specifications tool's Query Builder, you can construct full SQL SELECT statements, including inner joins of multiple tables and feature classes. If needed, you can fully specify all the clauses (SELECT, FROM, WHERE, GROUP BY, and ORDER BY) that a SQL query supports.

Steps:
  1. Start ArcMap.
  2. If necessary, load data in the map.
  3. Right-click the layer for which you want to define a calculated specification rule and click Properties.

    The Layer Properties dialog box appears.

  4. Click the Calculated Representations or Calculated Fields tab.
  5. If necessary, create a new specification rule.
  6. Click the SQL Statement drop-down arrow and click Edit SQL statement.

    The Query Builder dialog box appears.

    Query Builder dialog box
  7. Click Add Table.

    The Add Table dialog box appears.

  8. Navigate to the feature class, relationship class, or table you want to add to the statement.
  9. Click Add.

    The Query Builder dialog box appears.

  10. Choose the field from the added table to use in the selection.
  11. Click Add to SELECT if you want to be able to use the field value to later define a VBScript.
  12. Click Add to WHERE to use the field to determine your selection set.
  13. Click All Values.

    All the unique values for the field appear in the Values list.

  14. Choose one of the values in the Values list.
  15. Click Add to WHERE.
  16. Click one of the operator buttons.
  17. Repeat steps 10–16 until your statement is complete.
  18. Click Verify to validate the SQL statement.
  19. Click OK.
    TipTip:

    You can clear the contents of the SELECT OBJECTID and WHERE fields by clicking Clear.


4/17/2012