SQL expression examples  Selecting tables and views

Chapter 17: Defining DataWindow Objects

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 the Select painter, where you can paint a SELECT statement that includes the following:

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

For more information about queries, see “Defining queries”.

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.

    For more information, see “Using retrieval arguments”.

  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 the Return button on the PainterBar.

    You return to the wizard to complete the definition of the DataWindow object.





Copyright © 2004. Sybase Inc. All rights reserved. Selecting tables and views

View this book as PDF