Using SQL Select

In specifying data for a DataWindow object, you have more options for specifying complex SQL statements when you use SQL Select as the data source. When you choose SQL Select, you go to Visual SQL, where you can create a SELECT statement that includes the following:

NoteSaving your work as a query While in Visual SQL, you can save the current SELECT statement as a query by selecting File>Save As from the menu bar. Doing so allows you to easily use this data specification again in other DataWindows.

StepsTo define the data using SQL Select:

  1. Click SQL Select in the Choose Data Source dialog box in the wizard and click Next.

    The Select Tables dialog box displays.

  2. Select the tables and/or views that you will use in the DataWindow object.

    For more information, see “Selecting tables and views”.

  3. Select the columns to be retrieved from the database.

    For more information, see “Selecting columns”.

  4. Join the tables if you have selected more than one.

    For more information, see “Joining tables”.

  5. Select retrieval arguments if appropriate.

  6. Limit the retrieved rows with WHERE, ORDER BY, GROUP BY, and HAVING criteria, if appropriate.

    For more information, see “Specifying selection, sorting, and grouping criteria”.

  7. If you want to eliminate duplicate rows, select Distinct from the Design menu. This adds the DISTINCT keyword to the SELECT statement.

  8. Click OK.