[英]sql select with does not contain
This is my select: 这是我的选择:
select MY_ID, JOB_ID
from MY_TABLE
where JOB_ID != 'bra%'
and JOB_ID != 'wes%'
and STS_DTTM < trunc (sysdate) -12
It still selects fields with values that contain "bra" and "wes" 它仍然选择值包含“bra”和“wes”的字段
Thank you & regards, 谢谢你,问候,
Should be: 应该:
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;
And the column name should be job_name or job_code, not Job_id. 列名称应为job_name或job_code,而不是Job_id。 Job_id sounds like a number :)
Job_id听起来像一个数字:)
use NOT LIKE instead of != 使用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
I'am not sure, but this SQL request might works: 我不确定,但这个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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.