。Access里执行left join联合查询,总是提示:至少一个参数未指定的错误,突然想起来access中多表联合查询的sql语句比较变态,就抄来高手的文章备忘,希望对和我一样的苦逼程序员有所帮助。

首先,每次联合查询都需要用圆括号括起来:

SELECT * FROM (aa LEFT JOIN bb ON aa.a = bb.a ) LEFT JOIN cc ONcc.a = bb.a;

注意:在使用join语句查询时,如果有加多个On条件,必须用括号括起来,如:

SELECT * FROM (aa LEFT JOIN bb ON aa.a=bb.a) LEFT JOIN cc ON(bb.a=cc.a and bb.b=cc.b)

其他例子可以参考:

1、SELECT * FROM URL as a LEFT OUTER JOIN MobileAfter as b ON a.URL = b.URL

2、SELECT * FROM (URL as a LEFT OUTER JOIN MobileAfter as b ON a.URL= b.URL) LEFT OUTER JOIN MobileBefore as c ONc.URL=a.URL

3、SELECT * INTO Ttable1 FROM ((((URL as a

LEFT OUTER JOIN MobileAfter as b ON a.URL=b.URL)

LEFT OUTER JOIN MobileBefore as c ON c.URL=a.URL)

LEFT OUTER JOIN TeleCOM as d ON d.URL=a.URL)

LEFT OUTER JOIN UniCOM as e ON e.URL=a.URL)

摘录
计算机