如果列包含空值或空值或'0'或使用sql查询的特定值,则从表中获取所有记录 [英] get all records from table if column contains null or empty or '0' or a particular value using sql query
本文介绍了如果列包含空值或空值或'0'或使用sql查询的特定值,则从表中获取所有记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个表,该表的``状态''列.此列包含空值,还包含``0'',还包含空值和特定值,例如ex:=''000000''.我想获取所有状态为``null'',``0'',空和``000000''的记录,如果我在where条件中提供``000000''.我该怎么做? ="h2_lin">解决方案
尝试WHERE ISNULL(status, ''0'') IN (''000000'', ''0'','''')
您可以将SQL IS NULL测试与IN(...)结合使用.
即WHERE Status IS NULL or Status IN ('''',''0'',''000000'')
i have a table which has column ''status''.this column contain null values,it also contains ''0'',also contains empty values and a particular value say for ex:=''000000''.i want to get all records with status ''null'',''0'',empty and also ''000000'' if i supply ''000000'' in my where condition.How can i do this?
解决方案
TryWHERE ISNULL(status, ''0'') IN (''000000'', ''0'','''')
You can use the SQL IS NULL test combined with an IN (...).
i.e.WHERE Status IS NULL or Status IN ('''',''0'',''000000'')
这篇关于如果列包含空值或空值或'0'或使用sql查询的特定值,则从表中获取所有记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文