How to: Add Tables to Views
You can access data stored in other tables by adding those tables to your local or remote view and specifying join conditions for the added tables.
Specifying join conditions between the tables you add help determine which records from the two tables should be compared and returned. For more information, see How to: Control Record Selection with Joins and Join Conditions for Tables, Queries, and Views.
Note
When you add tables to an existing view programmatically, the CREATE SQL VIEW command produces a cross product.
To add a table to a local view
Open the view in the Project Manager or Database Designer.
The View Designer opens.
On the Query menu, click Add Tables.
In the Add Table or View dialog box, select the table or view you want to add.
The table or view you selected appears in the View Designer.
In the Join Condition dialog box, specify the join condition you want, and click OK.
If you want to specify an alias for each table that you select, type it in the Alias box.
When you are finished, click Close.
For more information, see Query and View Designers and Join Condition Dialog Box.
To add a table to a remote view
Open the view in the Project Manager or Database Designer.
The View Designer opens.
On the Query menu, click Add Tables.
In the Open dialog box, click each table you want to add, and then Add.
The table you selected appears in the View Designer.
In the Join Condition dialog box, specify the join condition you want, and click OK.
If you want to specify an alias for each table that you select, type it in the Alias box.
When you are finished, click Close.
For more information, see Query and View Designers, Select Connection or Data Source Dialog Box and Join Condition Dialog Box.
To add a table to views programmatically
In the SQL SELECT statements specified by the CREATE SQL VIEW command, add table names and join conditions for the tables you add using the FROM and WHERE clauses.
Visual FoxPro displays a confirmation dialog box to overwrite the existing view.
In the confirmation dialog box, click Yes.
For more information, see CREATE SQL VIEW Command.
See Also
Tasks
How to: Select Fields for Views