Oracle sql where后面的多条件case when判断执行

sql code:

select * from table_name t

where (case when t.table_column='条件' then t.table_column

when t.table_column='条件' then t.table_column end)='条件'

my sql code:

-- 测试sql

SELECT  *FROM PROJECT_INFO pi

WHERE (CASE WHEN PI.START_DATE_OF_REMOTE_AUDIT IS NOT NULL THEN
TO_CHAR(PI.END_DATE_OF_REMOTE_AUDIT, 'yyyy-mm-dd')
WHEN PI.START_DATE_OF_REMOTE_AUDIT IS NULL THEN
TO_CHAR(PI.END_DATE_OF_SITE_AUDIT, 'yyyy-mm-dd')
END)<'2019-09-18'
ORDER BY APPROVED_ID;

转载于:https://www.cnblogs.com/wk814007042/p/11537749.html

你可能感兴趣的:(数据库)