Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/83.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 与其他谓词结合使用IN运算符_Sql_Sql Server - Fatal编程技术网

Sql 与其他谓词结合使用IN运算符

Sql 与其他谓词结合使用IN运算符,sql,sql-server,Sql,Sql Server,我有一个左连接查询。where子句中有两个谓词。首先,我在select语句中使用IN运算符。在第二个谓词中,我检查IsActive列是否为true。但是,我不允许像下面那样使用&operator-我收到一个错误: 附近语法不正确& 代码: 我做错了什么?你在找和 select Table1.Id from Table1 Left Join Table2 On Table1.Id= Table2.Table1Id where Table1.IntColumn in (Sele

我有一个左连接查询。where子句中有两个谓词。首先,我在select语句中使用IN运算符。在第二个谓词中,我检查
IsActive
列是否为true。但是,我不允许像下面那样使用&operator-我收到一个错误:

附近语法不正确&

代码:


我做错了什么?

你在找

select Table1.Id 
from Table1 Left Join
     Table2
     On Table1.Id= Table2.Table1Id
where Table1.IntColumn in (Select Table3.IntColumn
                           from Table3
                           where Table1.Id = Table3.Id
                          ) and
      Table1.IsActive = 1)

使用
运算符。
是一个;谢谢,我还以为我还在用c语言编程呢。
select Table1.Id 
from Table1 Left Join
     Table2
     On Table1.Id= Table2.Table1Id
where Table1.IntColumn in (Select Table3.IntColumn
                           from Table3
                           where Table1.Id = Table3.Id
                          ) and
      Table1.IsActive = 1)