Creating Outer Joins with Remote Data

You can use SQL pass-through to perform outer joins on remote data using native server syntax, if your server supports outer joins. An outer join combines information from one or more tables regardless of whether matching rows are found.

To perform an outer join on a server

  • Use the SQLEXEC( ) function with the server's outer join syntax.

For example, the following code uses the Visual FoxPro SQL pass-through function SQLEXEC( ) to display the results of an outer join on SQL Server using the active named connection sqlremote:

? SQLEXEC(sqlremote, 'select au_fname, au_lname, pub_name ;
               from authors, publishers ;
               where authors.city *= publishers.city')
BROWSE

For more information on outer join syntax and types of outer joins, see your server documentation. For information on creating a named connection, see "Defining a Connection" in Creating Views.

See Also

Creating a Parameterized Query | Execution of ODBC Extensions to SQL | Using SQL Pass-Through Technology | Implementing a Client/Server Application | Designing Client/Server Applications | Upsizing Visual FoxPro Databases | Creating Views