select distinct customer_name from borrower ,loan
where  borrower.loan_number = loan.loan_number and branch_name ='Perryridge'
and (branch_name , customer_name) in (select branch_name,customer_name
from depositor,account where depositor.account_number = account.account_number)
',' 附近有语法错误。
提示第3行附近有语法错误,环境是SQL2005 我是照着数据库原理方面的书敲的,是sql的不支持的原因吗?
请教下,先谢了!

解决方案 »

  1.   

    重了.
    select distinct customer_name from borrower ,loan
        where  borrower.loan_number = loan.loan_number and branch_name ='Perryridge'
        and branch_name in (select branch_name
            from depositor,account where depositor.account_number = account.account_number)
        and customer_name in (select customer_name
            from depositor,account where depositor.account_number = account.account_number)
      

  2.   


    select distinct customer_name from borrower a ,loan b
        where  borrower.loan_number = loan.loan_number and branch_name ='Perryridge'
        --and (branch_name,customer_name) in (select branch_name,customer_name
          and exists(select 1 
            from depositor,account where depositor.account_number = account.account_number 
                 and a.branch_name =branch_name and a.customer_name = customer_name)--in不可以用多个字段
      

  3.   

    引用楼主 zedzhao 的帖子:
    SQL code 
    select distinct customer_name from borrower ,loan 
        where  borrower.loan_number = loan.loan_number and branch_name ='Perryridge' 
        and (branch_name , customer_name) in (select branch_name,customer_name 
            from depositor,account where depositor.account_number = account.account_number) 
    ',' 附近有语法错误。 
    提示第3行附近有语法错误,环境是SQL2005 我是照着数据库原理方… 
     这里面只能有一个字段吧?