Un recoginised关键字就像我在sql中使用Not Like时那样

时间:2020-12-15 20:51:56

i am trying to use not like in my sql query but it gives me error . please help.

我试图使用不喜欢在我的SQL查询但它给我错误。请帮忙。

SELECT word FROM school WHERE level  LIKE '%level%' AND NOT LIKE '%llevel%'

4 个解决方案

#1


2  

USe column name level for both condition.

使用两个条件的列名称级别。

      SELECT word FROM school WHERE level  LIKE '%level%' AND level  NOT LIKE '%llevel%'

#2


1  

You've missed level column name in second condition:

您在第二个条件中错过了级别列名称:

SELECT word FROM school WHERE level  LIKE '%level%' AND level NOT LIKE '%llevel%'

#3


0  

You are missing level before the NOT LIKE

在NOT LIKE之前你缺少等级

SELECT word FROM school WHERE level  LIKE '%level%' AND level NOT LIKE '%llevel%'

#4


0  

Using REGEXP:

使用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.

这假定您想要的匹配形式为至少一个字符后跟level,后跟零个或多个字符。您的原始查询意味着这种情况。

#1


2  

USe column name level for both condition.

使用两个条件的列名称级别。

      SELECT word FROM school WHERE level  LIKE '%level%' AND level  NOT LIKE '%llevel%'

#2


1  

You've missed level column name in second condition:

您在第二个条件中错过了级别列名称:

SELECT word FROM school WHERE level  LIKE '%level%' AND level NOT LIKE '%llevel%'

#3


0  

You are missing level before the NOT LIKE

在NOT LIKE之前你缺少等级

SELECT word FROM school WHERE level  LIKE '%level%' AND level NOT LIKE '%llevel%'

#4


0  

Using REGEXP:

使用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.

这假定您想要的匹配形式为至少一个字符后跟level,后跟零个或多个字符。您的原始查询意味着这种情况。