Sql 与其他谓词结合使用IN运算符
我有一个左连接查询。where子句中有两个谓词。首先,我在select语句中使用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
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)