嘿,伙计们一直试图为我的项目解决这个问题,这让我疯狂......我已经尝试了一切。根据指示
“列出Docents(Custid,Custname),其专长不包括Van Gogh和Chagall。”
以下是两个表
CUSTID CUSTNAME
1301 Disney
1806 Garcia
1502 LaGardia
1207 Perry
1280 Beecham
1822 Becker
1140 Klim
1509 Roberts
1619 Robins
1111 Bardot
1515 David
1701 Martin
1904 Gross
1236 Brooks
1430 Todd
CUSTID SPECIALTY
1430 Dufy
1430 Monet
1430 Van Gogh
1502 Chagall
1502 Cubism
1502 Van Gogh
1619 Da Vinci
1822 Italian Renaissance
1904 Chagall
1904 Van Gogh
我已经尝试过了
SQL> select customer.custid,customer.custname
from customer,docent_expertise
where customer.custid=docent_expertise.custid
and specialty not in ('Van Gogh','Chagall')
group by customer.custid,customer.custname;
我的结果是
CUSTID CUSTNAME
---------- -----------
1822 Becker
1619 Robins
1430 Todd
1502 LaGardia
如果你能看到Cust 1430和1430不在那里!! 请帮忙!!
请随意要求更清晰,我知道我的问题可能看起来有点模糊。
答案 0 :(得分:0)
客户1502不应该是因为他/她具有“梵高”特色。 这应该有效:
select customer.custid,customer.custname
from customer,docent_expertise
where customer.custid=docent_expertise.custid
and customer.custid not in (select custid
from docent_expertise
where specialty in ('Van Gogh','Chagall')
);
输出:
CUSTID CUSTNAME
------ --------
1619 Robins
1822 Becker