我发现有关重用子查询结果的帖子,但没有提到有关IN运算符
的内容我的查询如下:
select count(*)
from X
where ...
and X.id NOT IN (select id from Y)
and X.id IN (select id from Z
where ...
and Z.id IN (select id from Y)
)
如您所见,子查询从Y 中选择ID重复
如何在IN运算符中重用子查询的结果?