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')