Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
sql选择列不包含数字的位置_Sql_Postgresql_Select - Fatal编程技术网

sql选择列不包含数字的位置

sql选择列不包含数字的位置,sql,postgresql,select,Sql,Postgresql,Select,我需要一个sql命令来选择所有不包含特定数字的行 我所拥有的: Select * from table Where (col1 != 1 or col2 != 1 or col3 != 1) 问题是,这不会选择任何列为空的行。 所有3列都是整数类型。使用不同于而不是!=对于可为空的列: select * from my_table where ( col1 is distinct from 1 or col2 is distinct from 1

我需要一个sql命令来选择所有不包含特定数字的行

我所拥有的:

    Select * from table
    Where (col1 != 1 or col2 != 1 or col3 != 1)
问题是,这不会选择任何列为空的行。 所有3列都是整数类型。

使用不同于而不是!=对于可为空的列:

select * 
from my_table
where (
    col1 is distinct from 1 
    or col2 is distinct from 1 
    or col3 is distinct from 1)

Tht仍然不会选择至少有1个空列的任何行。Oops。很抱歉你说空就是空。