在Sql Query
中只能指定一个表达式select PageID
from page
where PageID in (select DocumentId
from PDFDocument
where DocumentId in (select * from RunDocument)
)
答案 0 :(得分:3)
您有select *
,其中只需要一列。您可以通过提及列来解决此问题:
select PageID
from page
where PageID in (select DocumentId
from PDFDocument
where DocumentId in (select DocumentId from RunDocument)
---------------------------------------------^
);
答案 1 :(得分:2)
你可以这样试试。
SELECT pg.PageID
FROM page pg
INNER JOIN PDFDocument pd
ON pd.DocumentId = pg.PageID
INNER JOIN RunDocument rd
ON rd.DocumentId = pd.DocumentId
使用子查询
SELECT pg.PageID
FROM page pg
WHERE EXISTS (SELECT 1
FROM PDFDocument pd
INNER JOIN RunDocument rd
ON rd.DocumentId = pd.DocumentId
AND pd.DocumentId = pg.PageID);