Question:
Hetergenious joins: How do I join files from differing alias
(heterogeneous joins) using a SQL statment?
Answer:
For each server table, a connection must exist before the
query is executed. A TDatabase can be used to establish the
connection.
The SQL statement must use real alias names, as set up in
the BDE configuration utility, not DatabaseName properties
from a TDatabase.
The SQL syntax should be formatted as follows: a double
quote, a colon, a real alias name, a colon, the table name,
and a double quote. See example below.
Leave the DatabaseName property of the TQuery blank, unless
the alias is local. For example, specifying DBDEMOS in the
Query's DatabaseName property will work, but using IBLOCAL
will cause a general SQL error.
Example:
SELECT A.ITEMNO, B.VENDORNO
FROM ":DBDEMOS:ITEMS" A, ":IBLOCAL:VENDORS" B
WHERE A.VENDORNO = B.VENDORNO