問題描述
我有下面的視圖,我只想應用小過濾器,例如,我想忽略或刪除視圖中每個 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 視圖中應用過濾器的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!