Microsoft KB Archive/151797

= HOWTO: How To Create an SQL Outer Join Using the View Designer =

Article ID: 151797

Article Last Modified on 10/15/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Data Access Components 2.5

-



This article was previously published under Q151797



SUMMARY
This article explains how to create an outer join on a SQL Server table using the Remote View Designer. An outer join is necessary if the View needs to display not only matching rows between tables (rows with values in the specified columns that satisfy the join condition), but also non- matching rows. An outer join can only be performed if the backend DBMS supports it. This article uses the pubs database in Microsoft SQL Server.



MORE INFORMATION
This query uses the Authors table and the Publishers table and shows not only authors who have publishers in the same city, but also authors without publishers in the same city.

 Create a datasource to the pubs database on SQL Server. Create a new remote View, and select your new datasource created in step 1. Select the Authors table. Click again, and select the Publishers table. The join condition dialog appears showing:

Publishers.city - Authors.city

 Change the join condition to Right Outer Join. Select the following fields from the Authors table:

authors.au_fname

authors.au_lname

</li> Select the following field from the Publishers table:

Publisher.pub_name

</li> Run the query.</li></ol>

<div class="references_section">