0

找出只生产同类型型号的厂商,并且这些型号的数量超过1。

maker   model   type
 A      1232    PC
 A      1233    PC
 A      1276    Printer
 A      1298    Laptop
 A      1401    Printer
 A      1408    Printer
 A      1752    Laptop
 B      1121    PC
 B      1750    Laptop
 C      1321    Laptop
 D      1288    Printer
 D      1433    Printer
 E      1260    PC
 E      1434    Printer
 E      2112    PC
 E      2113    PC

结果应该是

 Model  Type   
  D      Printer 

我试过了

   Select maker,type from Product
   Group by maker ,type 
   Having count(*)>1

上面的查询给了我模型数量超过一个的制造商。但我找不到只生产相同类型的模型。请帮助

4

1 回答 1

2
Select Distinct Maker, Type From Product
 Where Maker In (Select Maker From Product 
                  Group By Maker 
                 Having Count(Distinct Type) = 1 
                    And Count(Distinct Model) > 1)
于 2012-12-11T10:26:16.597 回答