ms access / sql server 语法(我猜)
此查询:
SELECT sentmails.[VersandDatum],
sentmails.[DatumMailGeplant],
mailintervals.[Interval],
definitions.[Subject],
users.[Name],
sentmails.[MailArt],
Objekte.[Name],
sentmails.[Erledigt],
sentmails.[ID]
FROM Objekte
RIGHT JOIN (users RIGHT JOIN (definitions RIGHT JOIN (mailintervals RIGHT JOIN (sentmails) ON mailintervals.ID=sentmails.Intervall) ON definitions.ID=sentmails.Noti_ID) ON users.UID=sentmails.Funktion) ON Objekte.OId=sentmails.Objekt_ID
...在 ms access qbe 中工作正常,但在 sql server 中它返回“')'附近的语法不正确”错误。我真的很想知道为什么:
- 连接需要放在括号中?
- sql server 中不再有外连接了吗?
- 哪里需要更多括号?
this query:
SELECT sentmails.[VersandDatum],
sentmails.[DatumMailGeplant],
mailintervals.[Interval],
definitions.[Subject],
users.[Name],
sentmails.[MailArt],
Objekte.[Name],
sentmails.[Erledigt],
sentmails.[ID]
FROM Objekte
RIGHT JOIN (users RIGHT JOIN (definitions RIGHT JOIN (mailintervals RIGHT JOIN (sentmails) ON mailintervals.ID=sentmails.Intervall) ON definitions.ID=sentmails.Noti_ID) ON users.UID=sentmails.Funktion) ON Objekte.OId=sentmails.Objekt_ID
...works fine in ms access qbe, but in sql server it returns a "incorrect syntax near ')'" error. I'm really wondering why:
- the joins need to be in brackets?
- no more outer joins in sql server?
- somewhere more brackets needed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
MS Access 的 JOIN 语法略有不同。使用这个代替:
MS Access has a slightly different JOIN syntax. Use this instead:
您的
JOIN
语法不正确。您应该单独连接每个表,而不使用嵌套括号。您可能想要类似的内容:这是 MSDN 中的起点。
Your
JOIN
syntax is incorrect. You should be joining each table individually, without nested parentheses. You probably want something like:Here's a starting point in MSDN.