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 行: ',' 附近有语法错误。
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 行: ',' 附近有语法错误。
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)
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 )
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 )
但是MSSQL不支持这样的写法
in
(select branch_name,customer_name
小F 这里前后的集合元素个数不一样也能行吗
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
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 )
应该用and 吧
是OR?
和版本有关系吗 我的是sql 2000的
服务器: 消息 116,级别 16,状态 1,行 1
当没有用 EXISTS 引入子查询时,在选择列表中只能指定一个表达式。