SQL Not Like 语句不起作用 [英] SQL Not Like Statement not working

查看:26
本文介绍了SQL Not Like 语句不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在存储过程中有以下代码.

I have the following code within a stored procedure.

WHERE
    WPP.ACCEPTED = 1 AND
    WPI.EMAIL LIKE '%@MATH.UCLA.EDU%' AND
    (WPP.SPEAKER = 0 OR
    WPP.SPEAKER IS NULL) AND
    WPP.COMMENT NOT LIKE '%CORE%' AND
    WPP.PROGRAMCODE = 'cmaws3'

NOT LIKE 语句不起作用,是的,在任何人说任何话之前,COMMENT 列中的项目不包含 CORE,而所有其他列都可以.

The NOT LIKE statement is not working, and yes before anyone says anything there are items with the COMMENT column that does not include CORE and all the other columns are ok.

有人知道这是怎么回事吗?

Does anyone know what is wrong with this?

推荐答案

如果 WPP.COMMENT 包含 NULL,条件将不匹配.

If WPP.COMMENT contains NULL, the condition will not match.

这个查询:

SELECT  1
WHERE   NULL NOT LIKE '%test%'

不会返回任何东西.

NULL 列上,针对任何搜索字符串的 LIKENOT LIKE 都将返回 NULL.

On a NULL column, both LIKE and NOT LIKE against any search string will return NULL.

能否请您发布您认为应该返回但实际上没有返回的行的相关值?

Could you please post relevant values of a row which in your opinion should be returned but it isn't?

这篇关于SQL Not Like 语句不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆