I'm trying to select rows from a table with the exception of any rows containing 'NEW_' at the beginning. I think I have the logic correct but I am unsure of the syntax. Can anyone help me out?
SELECT *
FROM CUSTOMER e1
WHERE e1.cust_ref LIKE 'CUST_REF%'
AND e1.cust_ref NOT IN (SELECT e2.cust_ref
FROM CUSTOMER e2
WHERE e1.cust_ref = 'NEW_' + e2.cust_ref);
select * from CUSTOMER
WHERE cust_ref like 'CUST_REF%'
AND cust_ref not in
(select cust_ref from sd_filter_element where cust_ref not like 'NEW_%');
You should use like
to do this.
Here is SQL query for filter option
select *
from sd_filter_element
WHERE
cust_ref not like 'NEW_%';
If you just want cust refs that don't have "NEW_", why not just do this?
select c.*
from CUSTOMER c
WHERE c.cust_ref not like 'NEW_%' ;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.