gpt4 book ai didi

mysql - 如果我使用 IN 运算符来过滤 NULL 值和空格 它不起作用 为什么?

转载 作者:行者123 更新时间:2023-11-29 05:32:15 24 4
gpt4 key购买 nike

我有一张 table table1(id int,名称 VC,描述 VC);该表包含 100 条记录。对于描述列,它有一些空格和空值我想消除描述值为空或空格的行?

我试过这种方式

select * from table1 where description not in('',NULL); //Displaying nothing

But

select * from table1 where description in('',NULL);// It is displaying all the rows which contains white spaces but not Nulls

我很困惑。 IN 运算符也接受 varchar,如果我不使用 NOT,我会得到正确的结果,但如果我使用 NOt,为什么我得不到结果。

提前致谢..

最佳答案

试试这个:

select * from table1 where description not in('') and description is not null;

关于mysql - 如果我使用 IN 运算符来过滤 NULL 值和空格 它不起作用 为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13740648/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com