我对这样的结构有一个疑问:
SELECT distinct
...,
...,
(CASE WHEN
(select ... from ... where ...)
IS NULL
THEN 'Site' ||LOWER((
select ... from ... where ... and ...))
ELSE
(select ...
from ...
where ...)
END) as importantResult
FROM
...
WHERE
...现在我只需要从importantResult的结果中过滤一个值。我不能在WHERE中指定它。
我该怎么做?
发布于 2020-12-23 14:54:43
使用"this“作为CTE;然后进行筛选。
例如:
with temp as
(select distinct ... <your query goes here>
... as importantResult
from ...
)
select whatever
from temp
where importantResult = some_valuehttps://stackoverflow.com/questions/65420134
复制相似问题