Defining a SQL statement

When you are creating calculated representation and calculated field rules, you must define the set of features to be symbolized or for which you are going to create fields.

A SQL SELECT statement allows you to define a set of features based on any attributes within a feature class or on relationships between the feature class and other feature classes or stand-alone tables. For example, if the name of a feature is related to a record in a stand-alone table, you can write a query that states that the feature should be included as the query result if the field value is equal to the table value. If you want to select features from a feature class such as BuoyP, where the feature name is equal to the value in a field within a stand-alone table, you would configure a statement similar to the following:

  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. Choose the layer field you want to use in the selection or WHERE clause.
  8. Click Add to SELECT if you want to be able to use the field value to later define a VBScript.
  9. Click Add to WHERE to use the field to determine your selection set.
  10. Click All Values.

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

  11. Choose one of the values in the Values list.
  12. Click Add to WHERE.
  13. Click one of the operator buttons.
  14. Repeat steps 7–13 until your statement is complete.
  15. Click Verify to validate the SQL statement.
  16. Click OK.

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