Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/86.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 Server中两列的where子句中的条件_Sql_Sql Server_Database_Where Clause - Fatal编程技术网

如何组合SQL Server中两列的where子句中的条件

如何组合SQL Server中两列的where子句中的条件,sql,sql-server,database,where-clause,Sql,Sql Server,Database,Where Clause,我有一个简单的表numInfo,有两个整数列,分别是col1,col2。现在我想将它们与一个数字进行比较,因此我将编写如下查询: select * from numInfo where col1 < 26 OR col2 <26 从numInfo中选择*,其中col1

我有一个简单的表
numInfo
,有两个整数列,分别是
col1
col2
。现在我想将它们与一个数字进行比较,因此我将编写如下查询:

select * from numInfo where col1 < 26 OR col2 <26

从numInfo中选择*,其中col1<26或col2无法组合
的条件无法组合您需要的
的条件:

select * from numInfo where (col1 < 26 or col2 < 26);
从numInfo中选择*,其中(col1<26或col2<26);
您需要:

select * from numInfo where (col1 < 26 or col2 < 26);
从numInfo中选择*,其中(col1<26或col2<26);

这没有帮助,我不想在我的情况下写两次数字26。无论如何,你都需要符合语言要求。这没有帮助,我不想在我的情况下写两次数字26。无论如何,你都需要符合语言要求。