Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
fullypaglot
Starting Member
6 Posts |
Posted - 2013-08-08 : 09:24:24
|
Product(maker, model, type)PC(code, model, speed, ram, hd, cd, price)Laptop(code, model, speed, ram, hd, screen, price)Printer(code, model, color, type, price)(question which I dont even understand)Find out makers who produce only the models of the same type, and the number of those models exceeds 1.Deduce: maker, type |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-08-08 : 09:38:39
|
something likeSELECT t.maker,t.type,..other columns if any FROM Product tINNER JOIN (SELECT maker,COUNT(model) AS CntFROM ProductGROUP BY makerHAVING COUNT(DISTINCT type) =1)t1On t1.maker = t.makerWHERE t1.Cnt > 1 ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
fullypaglot
Starting Member
6 Posts |
Posted - 2013-08-08 : 09:45:50
|
thanks a lot it works perfectly the only thing which I added was distinct. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-08-08 : 09:52:42
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
|
|
|
|
|