如何一次连接到多个访问数据库 [英] how to connect to multiple access databases at one time
问题描述
谁能告诉我如何一次连接两个数据库?我需要为我们正在进行的转换获取两组数据.
Can someone please tell me how I can connect two databases at once? I need to get two sets of data for a conversion we are doing.
db1
和 db2
是名称.我以为我会这样做:
db1
and db2
are the names. I thought I would do:
select *
from db1.table1 as table1
inner join db2.table2 as table2 on table2.column = table1.table1.column
任何帮助都会很棒.
谢谢
推荐答案
Access 支持这种查询:
Access supports this kind of query:
SELECT a.d, b.*
FROM mylocalTable AS a,
myLocalTable AS b IN "C:\mydir\mysubdir\myext.mdb"
WHERE a.id = b.id;
替代等效语法:
SELECT a.d, b.*
FROM mylocalTable AS a
INNER JOIN
[DATABASE=C:\mydir\mysubdir\myext.mdb;].myLocalTable AS b
ON a.id = b.id;
在上面的例子中,外部 MDB 的路径遵循 8.3 文件命名风格.
执行 dir/x 以查找目录和文件的名称以查看其外观.
In the above example, the path to external MDB follows 8.3 file naming style.
Do a dir /x to find the name of the directory and file to see how it will look like.
例如c:\program files\mydatabase.mdb 可能看起来像 c:\progra~1\mydata~1.mdb.
e.g. c:\program files\mydatabase.mdb might look like c:\progra~1\mydata~1.mdb.
链接表是处理此问题的更好方法.
Linked table is a better way to deal with this.
这篇关于如何一次连接到多个访问数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!