17,377
社区成员
发帖
与我相关
我的任务
分享
--:求供应工程J1零件为红色的供应商号SNO
select distinct sno
from spj,p
where spj.jno='j1'
and spj.pno=p.pno
and color='红';
--事实上下面的则更高效
select distinct sno
from spj
where jno='j1'
and exists
(select *
from p
where spj.pno=p.pno and color='红');
--或者
select distinct sno
from spj
where jno='j1'
and pno in
(select pno
from p
where color='红');