Using SQL Select
Contents
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 the SQL Select
painter, where you can paint a SELECT statement that includes the
following:
-
More than one table
-
Selection criteria (WHERE clause)
-
Sorting criteria (ORDER BY clause)
-
Grouping criteria (GROUP BY and HAVING clauses)
-
Computed columns
-
One or more arguments to be supplied at runtime
Saving your work as a query
While in the SQL Select painter, 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.
For more information about queries, see Defining queries.
To define the data using SQL Select:
-
Click SQL Select in the Choose Data Source dialog box in the
wizard and click Next.The Select Tables dialog box displays.
-
Select the tables and/or views that you will use in the
DataWindow object.For more information, see Selecting tables and
views. -
Select the columns to be retrieved from the database.
For more information, see Selecting
columns. -
Join the tables if you have selected more than one.
For more information, see Joining
tables. -
Select retrieval arguments if appropriate.
For more information, see Using retrieval
arguments. -
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. -
If you want to eliminate duplicate rows, select Distinct from
the Design menu. This adds the DISTINCT keyword to the SELECT
statement. -
Click the Return button on the PainterBar.
You return to the wizard to complete the definition of the
DataWindow object. -
Click OK.