SQL Query

Function Description

SQL Query can query the records that meet specific conditions from the existing data. Query Conditions is mainly used to query the attributes of Dataset, which is independent of the spatial location. Data Types that can be queried include: point, line, surface, text, CAD, attribute table, 3D point, 3D line, 3D surface, network, and Route Dataset.

Function entrance

  • Spatial Analysis tab-> Query group-> SQL Query;
  • Toolbox-> Query-> SQL Query;

Operating instructions

  1. Click the Spatial Analysis tab-> Query group-> SQL Query button to pop up the SQL Query dialog;
  2. Set the Datasource and Dataset Information for SQL Query. You can add external or other Dataset Properties information through the Set Associated Fields button. Refer to the Set up the join table for setting the details of the associated field.
  3. Enter SQL Expression, which provides the following two input methods:
    • Check the Expression check box to display the query logic statement (Where, And, Or), field selection box, logic operator, value or field selection box, and delete button from left to right in the expression input box below. An Add Statement button is also provided below the expression to add multiple statements.
    • Select the SQLEdit check box to manually enter the SQL statement in the expression input box.

    In the toolbar on the expression input box, the tools are described as follows:

    • Import: You can quickly enter an expression by importing an.xml file;
    • Export: output the current SQL Expression as an.xml file for next use;
    • Clear: The information in the expression input box can be quickly and completely cleared through the Clear button;
    • Function: Click the function button to pop up the function dialog box on the right side of the SQL Query dialog box. Support the input of keyword search function, and the Search Results will be highlighted; after selecting a function in the Function List, the help description will display the meaning, syntax, parameter information of the function, and give an example of SQL Expression.
  4. In the advanced grouping, you can set the field sorting information of Search Result, Group Field, and Result Reserved Fields.
    • Sort field: The property sheet of the Search Result will be sorted in ascending or descending order according to the sort field.
    • Group Field: The records with the same value on the Specify Field are grouped together, and then the new temporary field result is obtained by performing statistical calculation on the Search Result through functions such as Aggregate and Math. Please refer to the SQL Query Grouping Statistics for details.
    • Result Reserved Fields: Set the Select Fields to be reserved for the Search Result, and check the fields through the Drop-down Button on the right.
      Caution:
      When

      using Aggregate, you need to directly fill in the expression in the result Reserved Fields. For example, if you need to query the maximum value of the "SmArea" field, you can directly fill in "Max (SmArea)" in the result Reserved Fields.

  5. Set Show Results and provide the following three Display Methods:
    • Browse Attribute Table: Select this item to open the Search Result in the form of attribute table.
    • Highlight in Map: Select this item to highlight the query result in Map.
    • High Light In Scene: Select this option to highlight the query result in Scene.
  6. Set Save Results to save the Search Result as a New Dataset.
  7. Execute the query. If there is an error in the expression or parameter, a prompt such as "The query result is null." Will appear in the Output Window. Please check whether the SQL statement is constructed correctly.

Related topics

SQL Query Grouping Statistics

SQL Query Common Expressions

Descriptions of functions that build SQL Query

SQL Associated Query Example