我有一个选择,当其他某些列满足条件时,我需要隐藏列中的数据。在Select语句中有办法做到这一点吗?
这是我尝试过的:
SELECT acc.account_no, (case substr(acc.bank,18,3) when acc.account_no like'%011006000%' then ' ' end) "BANK_ACCOUNT", sum(acc.bills) "BILLS"
FROM BNK.Bank_Transaction acc
WHERE acc.Bill_Date BETWEEN '01.05.2018' AND '29.05.2018'
AND (acc.account_no LIKE '%011006000%'
OR acc.account_no LIKE '%011076000%')
我在上部选择中收到 ORA-00905:缺少关键字错误。
答案 0 :(得分:2)
您可能需要:
select case when account_no like '%011006000%'
then null
else substr(..)
end as yourColumn,
...
from ...