Alex Rivera | Logout

SQL query with NOT LIKE IN

Asked 2012-02-22T10:55:33.823
83

Please help me to write an SQL query with the condition as NOT LIKE IN.

SELECT *
FROM Table1
WHERE EmpPU NOT Like IN ('%CSE%', '%ECE%', '%EEE%');

The above example returns an error.

Edit
Report

1 Answer

6

you cant combine LIKE and IN

you can do:

select * from Table1
where EmpPU not in ('%CSE%', '%ECE%', '%EEE%')

but you wont benefit from the % wildcard

if you need the % the only option is:

Select * from Table1
where EmpPU not like '%CSE%' and  EmpPU not like '%ECE%' and EmpPU not like '%EEE%'
answered 2012-02-22T11:09:58.147

Your Answer