Reputation: 115
i am trying to use not like in my sql query but it gives me error . please help.
SELECT word FROM school WHERE level LIKE '%level%' AND NOT LIKE '%llevel%'
Upvotes: 1
Views: 69
Reputation: 522741
Using REGEXP
:
SELECT word
FROM school
WHERE level REGEXP '%[^l]level%'
This assumes that the matches you want are of the form of at least a single character followed by level
, followed by zero or more characters. Your original query implies this to be the case.
Upvotes: 0
Reputation: 332
You are missing level
before the NOT LIKE
SELECT word FROM school WHERE level LIKE '%level%' AND level NOT LIKE '%llevel%'
Upvotes: 0
Reputation: 26886
You've missed level
column name in second condition:
SELECT word FROM school WHERE level LIKE '%level%' AND level NOT LIKE '%llevel%'
Upvotes: 1
Reputation: 3106
USe column name level for both condition.
SELECT word FROM school WHERE level LIKE '%level%' AND level NOT LIKE '%llevel%'
Upvotes: 2