IN 子句示例

下列表显示您如何使用 IN 子句来捕获外部数据库的数据。在每一示例之中,假设客户表是保存在外部数据库之中。

外部数据库 SQL 语句
Microsoft® Jet 数据库 SELECT CustomerID
FROM Customers
IN OtherDB.mdb
WHERE CustomerID Like "A*";
dBASE III 或 IV.
捕获数据由 一 dBASE III 表,以 "dBASE III;" 替代 "dBASE IV;"。
SELECT CustomerID
FROM Customer
IN "C:\DBASE\DATA\SALES" "dBASE IV;"
WHERE CustomerID Like "A*";
dBASE III 或 IV 使用数据库语法。 SELECT CustomerID
FROM Customer
IN "" [dBASE IV; Database=C:\DBASE\DATA\SALES;]
WHERE CustomerID Like "A*";
Paradox 3.x 或 4.x.
若要由一Paradox version 3.x 表捕获数据,以 "Paradox 3.x;" 替代 "Paradox 4.x;"。
SELECT CustomerID
FROM Customer
IN "C:\PARADOX\DATA\SALES" "Paradox 4.x;"
WHERE CustomerID Like "A*";
Paradox 3.x 或 4.x 使用数据库语法. SELECT CustomerID
FROM Customer
IN "" [Paradox 4.x;Database=C:\PARADOX\DATA\SALES;]
WHERE CustomerID Like "A*";
Microsoft EXCEL工作表 SELECT CustomerID, CompanyName
FROM [Customers$]
IN "c:\documents\xldata.xls" "EXCEL 5.0;"
WHERE CustomerID Like "A*"
ORDER BY CustomerID;
在工作表之中的一个命名范围 SELECT CustomerID, CompanyName
FROM CustomersRange
IN "c:\documents\xldata.xls" "EXCEL 5.0;"
WHERE CustomerID Like "A*"
ORDER BY CustomerID;