Condividi tramite


Creating a Multitable View

To access related information stored in separate tables, you can add tables to a new or existing view. When adding tables, you can control records returned in the view by defining a join condition between tables, if one does not already exist. Defining and specifying a join condition between two tables help determine which records from the two tables should be compared and returned. For more information about specifying join conditions, see Controlling Record Selection with Joins and Join Conditions for Tables, Queries, and Views.

Adding Tables to a Local View

To add a table to a local view

  1. From the Project Manager, create a new or open an existing local view.
  2. Click the View Designer to bring it to the foreground.
  3. From the Query menu, select Add Tables and the table or view you want to add.

You can also open a database and add table names to the FROM clause and join conditions using the CREATE SQL VIEW command. Adding tables using the CREATE SQL VIEW command produces a cross product.

Note   You must specify a join condition in either the FROM or WHERE clause of the SQL statement passed to CREATE SQL VIEW to match related records between the tables. If persistent relationships between the tables exist, they are automatically used as join conditions.

For more information, see CREATE SQL VIEW Command.

Adding Tables to a Remote View

When you connect to a remote data source, you can obtain access to many related tables. You can select the tables you need and adjust the relationships between them, if necessary, to get the information you need.

To create a remote view with multiple tables

  1. From the File menu, choose New, select Remote View, and choose New File.
  2. In the Select Connection or Data Source dialog box, select a predefined connection or an available data source.
  3. If required, log on to the server.
  4. In the Open dialog box, select the tables you want to use.
  5. In the Join Condition dialog box, set the join condition by accepting the default join, or set up the join as needed.

As with local views, you can control how updates are made to the source tables by using the options in the Update Criteria tab in the View Designer.

See Also

Working with Views | Creating Views | Accessing Remote Data with Views