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.

An 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:

SELECT OBJECTID FROM BuoyP, PRODMAP_FREL WHERE LNAM=PRODMAP_FREL.SRCNAM
步骤:
  1. Right-click the layer for which you want to define a calculated specification rule and click Properties.

    The Layer Properties dialog box appears.

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

    The Query Builder dialog box appears.

    Query Builder dialog box
  5. Choose the layer field you want to use in the selection or WHERE clause.
  6. Click Add to SELECT if you want to be able to use the field value to later define a VBScript.
  7. Click Add to WHERE to use the field to determine your selection set.
  8. Click All Values.

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

  9. Choose one of the values in the Values list.
  10. Click Add to WHERE.
  11. Click one of the operator buttons.
  12. Repeat steps 5–11 until your statement is complete.
  13. Click Verify to validate the SQL statement.
  14. Click OK.
    提示提示:

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


9/30/2010