SQLite 中嵌套内连接的问题

发布于 2024-11-29 20:58:59 字数 332 浏览 2 评论 0原文

下面的sql语句不会在SQLite中运行:

select * 
from A
left join (B inner join C on B.fkC = C.pk) on A.optionalfkB = B.pk

我得到一个sqlException“未知列B.pk”

根据文档@ http://www.sqlite.org/lang_select.html 这应该可以工作,并且它可以在所有其他 sql 实现中工作。我做错了什么吗?

The sql statement below will not run in SQLite:

select * 
from A
left join (B inner join C on B.fkC = C.pk) on A.optionalfkB = B.pk

I get a sqlException "unknown column B.pk"

According to the documentation @ http://www.sqlite.org/lang_select.html this should work, and it will work in all other sql implementations. Am I doing something wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北座城市 2024-12-06 20:58:59

它不起作用,因为“外部”查询不知道 B 是什么。

select * 
from A
left join (B inner join C on B.fkC = C.pk) B on A.optionalfkB = B.pk

如果没有任何 select(B inner join C on B.fkC = C.pk) 很奇怪,但规范确实说它是有效的。

It doesn't work because the "outer" query doesn't know what B is.

select * 
from A
left join (B inner join C on B.fkC = C.pk) B on A.optionalfkB = B.pk

The (B inner join C on B.fkC = C.pk) is weird without any select, but the specification does say that it is valid.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文