SQLIte中嵌套内部联接的问题 [英] problem with nested inner joins in SQLIte
本文介绍了SQLIte中嵌套内部联接的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下sql语句无法在SQLite中运行:
选择*来自AA.optionalfkB = B.pk上的左联接(B.fkC上的B内部联接C = C.pk)
我得到sqlException未知列B.pk"
根据文档@ http://www.sqlite.org/lang_select.html 这应该工作,并且将在所有其他sql实现中工作.我在做错什么吗?
解决方案
它不起作用,因为外部"查询不知道B是什么.
选择*来自A左联接(B.fkC = C.pk上的B内部联接C)B. A.optionalfkB = B.pk
(B.fkC = C.pk上的B内部联接C)
很奇怪,没有任何 select
,但是规范确实说这是有效的.>
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?
解决方案
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.
这篇关于SQLIte中嵌套内部联接的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文