MicroStation CONNECT Edition Help

To Use the Visual SQL Query Builder to Build a Query: Example 4

  1. Click Clear All to clear any existing tables.
  2. In the Select tab page, click Tables or from the Tables menu choose Open Table.
  3. In the Select Table dialog, double-click Parcel.
  4. In the Select Table dialog, click Cancel.
  5. In the Parcel dialog, double-click the Owner and Parc_area fields.

    The following is in the SQL Select Statement text box:

    SELECT  owner, parcel_area
    FROM  parcel
  6. Click the Functions option button and choose Average Value of.
  7. In Parcel, double-click parc_value.

    The following text is in the SQL Select Statement text box:

    SELECT  owner, parc_area, AVG(parc_value)
    FROM parcel
    GROUP BY  owner, parc_area
  8. To edit the GROUPBY clause, click the GroupBy tab page.

    The GroupBy tab page opens.



  9. In the GroupBy Fields list box, click parc_area. Click the > (greater than) Common Operator, enter 100000 in the Value text field, and press <Enter>.
  10. Click Apply to generate the following statement:
    SELECT  owner,  parc_area,  AVG(parc_value)
    FROM parcel
    GROUP BY  owner, parc_area, HAVING parc_area > 100000
  11. To add the OrderBy clause, click the OrderBy tab page.

    The OrderBy tab page opens.



  12. In the Available Fields list box, click parc_area.

    The selected field appears in the OrderBy Field text box.

  13. Click Apply to add a OrderBy clause to the SQL Select Statement text box.

    The query in the SQL Select Statement text box is complete:

    SELECT  owner,  parc_area, avg (parc_value), 
    FROM parcel
    GROUP BY  owner, parc_area having parc_area > 100000
    ORDER BY  parc_area
  14. Click Execute to display the results of the query in either a dialog form (Output > Form) or in the Visual SQL Data Browser dialog (Output > Browser).