select d.customer_name
from depositor d,account a
where d.account_number=a.account_number and branch_name='Perryridge' and (branch_name ,customer_name)
in
(select branch_name,customer_name
from borrower b,loan l
where b.loan_number=l.loan_number )服务器: 消息 170,级别 15,状态 1,行 3
第 3 行: ',' 附近有语法错误。

解决方案 »

  1.   

    select d.customer_name
    from depositor d,account a
    where d.account_number=a.account_number and branch_name='Perryridge' and 
    EXISTS 
    (select branch_name,customer_name
    from borrower b,loan l
    where b.loan_number=l.loan_number AND branch_name=A.branch_name AND customer_name=A.customer_name)
      

  2.   

    select d.customer_name 
    from depositor d,account a 
    where d.account_number=a.account_number and branch_name='Perryridge' and branch_name 
    in 
    (select branch_name
    from borrower b,loan l 
    where b.loan_number=l.loan_number ) 
    and customer_name in
     (select customer_name
    from borrower b,loan l 
    where b.loan_number=l.loan_number ) 
      

  3.   

    select d.customer_name 
    from depositor d,account a 
    where d.account_number=a.account_number and branch_name='Perryridge' and branch_name 
    in 
    (select branch_name,customer_name 
    from borrower b,loan l 
    where b.loan_number=l.loan_number ) 
    or 
    customer_name in 
    (select branch_name,customer_name 
    from borrower b,loan l 
    where b.loan_number=l.loan_number )
      

  4.   

    ..ORACLE 支持这样的写法。。
    但是MSSQL不支持这样的写法
      

  5.   

    and branch_name 
    in 
    (select branch_name,customer_name 
    小F 这里前后的集合元素个数不一样也能行吗
      

  6.   

    select d.customer_name 
    from 
    depositor d,account a ,borrower b,loan l 
    where d.account_number=a.account_number 
    and branch_name='Perryridge' and  b.loan_number=l.loan_number
      

  7.   

    --SORRY  没注意
    select d.customer_name 
    from depositor d,account a 
    where d.account_number=a.account_number and branch_name='Perryridge' and branch_name 
    in 
    (select branch_name
    from borrower b,loan l 
    where b.loan_number=l.loan_number ) 
    or 
    customer_name in 
    (select customer_name 
    from borrower b,loan l 
    where b.loan_number=l.loan_number )
      

  8.   


    应该用and 吧
    是OR?
      

  9.   

    可是我的报错啊
    和版本有关系吗  我的是sql 2000的
    服务器: 消息 116,级别 16,状态 1,行 1
    当没有用 EXISTS 引入子查询时,在选择列表中只能指定一个表达式。