Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 在查询中筛选选择结果_Sql_Oracle - Fatal编程技术网

Sql 在查询中筛选选择结果

Sql 在查询中筛选选择结果,sql,oracle,Sql,Oracle,我对这种结构有一个疑问: 选择不同的 ..., ..., 当 选择从…起哪里 是空的 然后“站点”| |降低 选择从…起哪里和 其他的 选择 从…起 哪里 作为重要结果结束 从…起 ... 哪里 ... 现在我只需要从importantResult的结果中过滤一个值。我无法在WHERE中指定这一点 我应该怎么做?将此用作CTE;然后过滤 例如: with temp as (select distinct ... <your query goes here> .

我对这种结构有一个疑问:

选择不同的 ..., ..., 当 选择从…起哪里 是空的 然后“站点”| |降低 选择从…起哪里和 其他的 选择 从…起 哪里 作为重要结果结束 从…起 ... 哪里 ... 现在我只需要从importantResult的结果中过滤一个值。我无法在WHERE中指定这一点


我应该怎么做?

将此用作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如何使用连接过滤主选择结果?三个子查询可以转换为左连接。