Sql 在查询中筛选选择结果
我对这种结构有一个疑问: 选择不同的 ..., ..., 当 选择从…起哪里 是空的 然后“站点”| |降低 选择从…起哪里和 其他的 选择 从…起 哪里 作为重要结果结束 从…起 ... 哪里 ... 现在我只需要从importantResult的结果中过滤一个值。我无法在WHERE中指定这一点Sql 在查询中筛选选择结果,sql,oracle,Sql,Oracle,我对这种结构有一个疑问: 选择不同的 ..., ..., 当 选择从…起哪里 是空的 然后“站点”| |降低 选择从…起哪里和 其他的 选择 从…起 哪里 作为重要结果结束 从…起 ... 哪里 ... 现在我只需要从importantResult的结果中过滤一个值。我无法在WHERE中指定这一点 我应该怎么做?将此用作CTE;然后过滤 例如: with temp as (select distinct ... <your query goes here> .
我应该怎么做?将此用作CTE;然后过滤 例如:
with temp as
(select distinct ... <your query goes here>
... as importantResult
from ...
)
select whatever
from temp
where importantResult = some_value
将其用作CTE;然后过滤 例如:
with temp as
(select distinct ... <your query goes here>
... as importantResult
from ...
)
select whatever
from temp
where importantResult = some_value
你的子查询相关吗?因为这也可以通过联接来实现。@Popeye如何使用联接来过滤主选择结果?三个子查询可以转换为左联接。您的子查询是否相互关联?因为这也可以通过连接来实现。@Popeye如何使用连接过滤主选择结果?三个子查询可以转换为左连接。