Apply filter in Oracle View(在 Oracle 视图中应用过滤器)
问题描述
我有下面的视图,我只想应用小过滤器,例如,我想忽略或删除视图中每个 IDENTIFIER 的所有行,其中 member_descr = 'O' 和 member_ratio <;= -5.
I have below view where i just wanted to apply small filter such that for example i want to ignore or remove all rows for each IDENTIFIER from the View where member_descr = 'O' and member_ratio < = -5.
我不确定是否要创建新的联合条件或应用过滤器,我正在为 member_descr = 'O' 计算 member_ratio 值的值
I am not sure if i want to create new Union condition or apply filter where i am calculating value for member_ratio value for member_descr = 'O'
目前在 fiddle 中,我们可以看到 member_ratio 值为 15.32778 for member_descr = 'O',计算后对于标识符 I0000RTERER3 是可以的.但是在计算 member_descr = 'O' 如果 member_ratio <= -5 那么我想从视图中忽略或删除此标识符的所有行.
Currently in the fiddle we can see the member_ratio value is 15.32778 for member_descr = 'O' which is ok for Identifier I0000RTERER3 after calculation. But after calculation for member_descr = 'O' if the member_ratio <= -5 then i want to ignore or remove all the rows for this identifier from view.
推荐答案
如果我现在明白我们需要 not exists
这里,
If I understood now we need not exists
here,
select *
from IS_ID t1
where not exists ( select 1
from IS_ID t2
where t1.identifier = t2.identifier
and (MEMBER_DESCR = 'O' and member_ratio < -5))
这篇关于在 Oracle 视图中应用过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Oracle 视图中应用过滤器
![](/xwassets/images/pre.png)
![](/xwassets/images/next.png)
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 更改自动增量起始编号? 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- SQL 临时表问题 2022-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01