Office中国论坛/Access中国论坛

标题: 这样的SQL的from子句错在拿里。 [打印本页]

作者: fanren    时间: 2003-12-21 05:52
标题: 这样的SQL的from子句错在拿里。
FROM (chlzbk LEFT JOIN cpfk ON chlzbk.序号 = cpfk.序号) LEFT JOIN zjfk ON chlzbk.序号 = zjfk.序号
作者: yangzn    时间: 2003-12-21 05:58
好象无法解释:

As when using Access QBE, you can create SELECT statements that join more
than two tables. Asimplified syntax for specifying joins of multiple tables in the
FROM clause is
FROM (… (table1 JOIN table2 ON conditionA) JOIN table3 ON conditionB)
JOIN …)
You may find this nested-style syntax a little confusing. It implies a set order in
which the joins are performed—for example, “first join table1 to table2 and then
join that result to table3 and then….” But the order of joins doesn’t really matter
in Access. No matter how you specify the order in the FROM clause, the Jet query
processor decides on the optimum ordering of joins for the sake of efficiency. This
is the way it should be in the relational model.
作者: yangzn    时间: 2003-12-21 06:03
书上是这么说的:
If you need to create a query that does not follow these rules, you can usually
break it up into multiple stacked queries that Jet can handle. For example, say you
wished to list all customers and the items they ordered but include customers

作者: yangzn    时间: 2003-12-21 06:06
比如这个就不行:
SELECT LastName, OrderDate,
Quantity, MenuDescription
FROM ((tblOrder INNER JOIN tblOrderDetails
ON tblOrder.OrderId = tblOrderDetails.OrderId)
INNER JOIN tblMenu ON tblOrderDetails.MenuId = tblMenu.MenuId)
RIGHT JOIN tblCustomer ON tblOrder.CustomerId =
tblCustomer.CustomerId
ORDER BY LastName, OrderDate DESC;
作者: fanren    时间: 2003-12-21 06:10
怎样分成多个查询。
作者: jack.powell    时间: 2009-12-13 22:40
高深,没懂!
作者: jack.powell    时间: 2009-12-13 22:43

作者: aries1912    时间: 2009-12-14 10:57
好像chlzbk不能在left join中有多次重名吧,你试一下:
select *, chlzbk as chlzbk_1
FROM (chlzbk LEFT JOIN cpfk ON chlzbk.序号 = cpfk.序号) LEFT JOIN zjfk ON chlzbk_1.序号 = zjfk.序号




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3