SQL子查询将只检查一列,当要求为同一查询检查2时失败

SQL子查询将只检查一列,当要求为同一查询检查2时失败,sql,Sql,当我在SQL Server 2014 Express中运行以下代码时,可以很好地为家庭关系表获取这位父亲的所有子女 select Name from Persons where ID in (select personID from FAMILY where fatherID in (select fatherID.ID from Persons fatherID

当我在SQL Server 2014 Express中运行以下代码时,可以很好地为家庭关系表获取这位父亲的所有子女

select Name 
from Persons 
where ID in (select personID 
             from FAMILY 
             where fatherID in (select fatherID.ID 
                                from Persons fatherID 
                                where fatherID.Name = 'Louis Vingo'))  
但是当我尝试用这个代码检查母亲和父亲时,我得到了一个错误

select Name 
from Persons 
where ID in (select personID 
             from FAMILY 
             where (fatherID, motherID) in (select fatherID.ID, motherID.ID  
                                            from Persons fatherID, Persons motherID 
                                            where fatherID.Name = 'Louis Vingo' 
                                              and motherID.Name = 'Dianne Vingo'))
错误:

在“,”附近预期条件的上下文中指定的非布尔型表达式。
“')附近的语法不正确


我读到的任何建议都可能是由于代码在这种情况下只使用一个参数造成的?

使用您的语法,您需要在条件下使用两个

where fatherID in (select p.ID from Persons p where p.Name = 'Louis Vingo') and
      motherID in (select p.ID from Persons p where p.Name = 'Dianne Vingo')

将其组合到单个子查询中是相当棘手的,而且不值得这样做。

这很有效。谢谢,我没有正确地将其拆分