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 |
|
Amber99
Starting Member
11 Posts |
Posted - 2009-04-05 : 14:22:55
|
| Hey! My answer is correct but it says: Your query produced correct result set on main database, but it failed test on second, checking database.* Wrong number of records (more by 2)Question: Exercise: 9Find the makers of the PCs that have speed not less than 450MHz. Result set: Maker. My Query:SELECT DISTINCT Product.maker FROM Product, PC where PC.speed >= 450 AND Product.type = 'PC' group by Product.makerwhats the deal? why am i wrong now? does anyone know?ThanksAmberThe database scheme consists of four tables: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) |
|
|
EugeneLim11
Posting Yak Master
167 Posts |
Posted - 2009-04-06 : 02:46:10
|
| is there any relationship between Pc and Product? there is no joint in your query. is the modelsame for product and PC?if so, your query should be SELECT DISTINCT Product.maker FROM Product, PC where PC.speed >= 450 AND Product.type = 'PC' AND PC.Model = Product.Model group by Product.makercheck out my blog at http://www.aquariumlore.blogspot.com |
 |
|
|
Amber99
Starting Member
11 Posts |
Posted - 2009-04-06 : 20:30:44
|
| works perfect!! Thanks! |
 |
|
|
besanu
Starting Member
1 Post |
Posted - 2010-12-06 : 11:42:11
|
There is an easier code : SELECT DISTINCT makerFROM product INNER JOINpc ON pc.model = product.modelWHERE pc.speed >= 450simple as 1,2,3 . . . |
 |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2010-12-06 : 13:17:41
|
| Please note: Almost 2 year old (homework) thread.--Gail ShawSQL Server MVP |
 |
|
|
|
|
|
|
|