有谁会SQL中的对多个表的left outer join啊? (100分)

  • 主题发起人 主题发起人 honestman
  • 开始时间 开始时间
H

honestman

Unregistered / Unconfirmed
GUEST, unregistred user!
  我用Delphi 5.x+Access 2000开发数据库。在查询的时候需要用若干个
“left outer join”。但是,在用Access 2000自带的工具调试的时候,发现怎么也通过
不了,为什么?
SELECT xm,yy,y1
from (SELECT DISTINCT gcbk.xmmc as xm FROM gdzctz, gcbk WHERE
gdzctz.xmmc=gcbk.xmmc and bkrq like "2001*" and fj="佛山" and yhfl="企业")
AS jbzl left outer join (select xmmc,sum(bkje) as yy from gcbk where
bkrq<"2001*" group by xmmc) as y on jbzl.xm=y.xmmc left outer join
(select xmmc,sum(bkje) as y1 from gcbk where bkrq like "2001-01*" group by
xmmc) as yy1 on jbzl.xm=yy1.xmmc;
调试时显示:
Syntax error (missing operator) in query expression 'jbzl.xm=y.xmmc left outer
join (select xmmc,sum(bkje) as y1 from gcbk where bkrq like "2001-01*" group
by xmmc) as yy1 on jbzl.xm=yy1.xmmc'.

 
Access can't use left outer join
 
但是,接一个“left outer join”是可以的。
 
Access 的 Left Outer Join 与 SQL Server 有所不同,你上面的写法是 SQL Server 语法
格式,Access 是一种类似嵌套的格式,比如:

SELECT Student.Code, Student.Name, Score.Score, Education.Name
FROM Education LEFT JOIN
(Student LEFT JOIN Score ON Student.Code = Score.Student_Code)
ON Education.Code = Student.Education;
 
在Access中的左外连接应这样写:
Select a.* From (TableA a Left Outer Join TableB b On a.XX=b.XX)
Left Outer Join TableC c On a.XX=c.XX
......
 
借honestman的场问:
left outer join在paradox中怎样写。paradox支持吗?
 
多人接受答案了。
 
后退
顶部