gpt4 book ai didi

MySQL : How to get records are have non null values?

转载 作者:行者123 更新时间:2023-11-29 04:59:21 26 4
gpt4 key购买 nike

我想获取所有记录,以防 result_1 不为空,如下所示:

SELECT ID,
Code,
NULLIF(CompareWithField,2.25) as result_1
FROM `data`
WHERE Indexed = 0
and code = 142
and 'result_1' is not null

但是,每次我运行查询时,即使 result_1 报告 NULL,我也会收到一个结果。

有什么解决办法吗?

最佳答案

这是因为您在引号内有 result_1。这将它从一个列名变成一个不为空的文本值。尝试...

SELECT ID,Code, NULLIF(CompareWithField,2.25) as result_1 FROM `data`
WHERE Indexed=0 and code=142 and result_1 is not null

关于MySQL : How to get records are have non null values?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3230056/

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