这是我的选择:
select MY_ID, JOB_ID
from MY_TABLE
where JOB_ID != 'bra%'
and JOB_ID != 'wes%'
and STS_DTTM < trunc (sysdate) -12
它仍然会选择值包含“bra”和“wes”
的字段谢谢你&amp;的问候,
答案 0 :(得分:4)
应该是:
select MY_ID, JOB_ID
from MY_TABLE
where JOB_ID not like 'bra%'
and JOB_ID not like 'wes%'
and STS_DTTM < trunc (sysdate) - 12;
列名应该是job_name或job_code,而不是Job_id。 Job_id听起来像一个数字:)
答案 1 :(得分:3)
使用NOT LIKE而不是!=
select MY_ID, JOB_ID
from MY_TABLE
where JOB_ID NOT LIKE'bra%'
and JOB_ID NOT LIKE 'wes%'
and STS_DTTM < trunc (sysdate) -12
答案 2 :(得分:1)
我不确定,但这个SQL请求可能有效:
select MY_ID, JOB_ID
from MY_TABLE
where NOT (JOB_ID LIKE 'bra%' OR JOB_ID LIKE 'wes%')
and STS_DTTM < trunc (sysdate) -12