1
有没有简单的方法来重新创建此语句?或者我可以在我的数据库中查找一个示例?因为目前我不明白它到底做了什么。我想我理解第一个in
,但我不知道为什么有项目两in
条款为什么第二个例子是不一样的第一个。提前致谢。了解嵌套的SQL语句
select usernumber as usrnr from DOCUMENTS
where CompanyIndex in (
select CompanyIndex
from DOCUMENTS
where DocumentType='3'
and ProjectsIndex in (select Index
from PROJECTS where
Projectnumber = 209806)
)
and ProjectsIndex in (
select Index
from PROJECTS
where Projectnumber = 209806
)
and DocumentType = '2'
而且我不明白为什么它是不一样的,因为这
select ad1 as AD1Nr from DOCUMENTS
where CompanyIndex in
(
select CompanyIndex
from DOCUMENTS
where DocumentType='3'
and ProjectsIndex in (select Index
from PROJECTS
where Projectnumber = 209806)
and DocumentType = '2')