Querying Two Databases with SQL

Last reviewed: October 31, 1994
Article ID: Q48151

SUMMARY

You can query two databases that share field types through the SQL interface of Q+E by performing the following three steps:

  1. The Select statement must include the name and field for both databases (separated by commas).

  2. The From statement must include both database names (separated by commas).

  3. There needs to be a Where statement to set the fields to equal (the criteria for selection).

Example

To select the first name, last name, and address information from databases ADDR.DBF and EMP.DBF, perform the following query under the SQL interface:

   SELECT emp.first_name, emp.last_name, addr.street,
   addr.city_state
   FROM c:\qe\emp.dbf,c:\qe\addr.dbf
   WHERE emp.number=addr.number

This procedure can also be performed by the using the menus.


KBCategory: kbother
KBSubcategory:

Additional reference words: 2.10


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 31, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.