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;
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;