Reputation: 690
I would like to select all records from a table which are not like '%select%'
but except these which contains '%select some_string%'
and '%select some_other_string%'
.
How do I do this in T-SQL?
Upvotes: 0
Views: 1595
Reputation: 17
You can try the following it may help
SELECT *
FROM TABLE
WHERE Coloumn NOT LIKE 'select'
AND Coloumn LIKE '%select some_string%'
Upvotes: 0
Reputation: 51888
With my english skills I get another solution than dasblinkenlight's:
WHERE (NOT (s LIKE '%select%'))
OR s LIKE '%select some_string%' OR s LIKE '%select some_other_string%'
Upvotes: 1
Reputation: 726639
A straightforward translation from English to SQL should work fine:
WHERE (NOT (s LIKE '%select%'))
AND NOT ((s LIKE '%select some_string%') OR (s LIKE '%select some_other_string%'))
Upvotes: 1