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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 can't deal with one SQL task plz HELP :S

Author  Topic 

balulilu
Starting Member

2 Posts

Posted - 2011-01-16 : 10:23:16
Hi guys, first I'm very sorry if I posted in wrong place.
well, thing is that I recently started to study SQL and was exercising on some simple tasks. There is one task that I managed to solve but it does not accepts my answer though it says that it returns the correct answer.

PLZ someone help me.


here is the the DB with table PC:
"PC(code, model, speed, ram, hd, cd, price)"

the TASK :
"Find the pairs of PC models having similar speeds and RAM. As a result, each resulting pair is shown only once, i.e. (i, j) but not (j, i).
Result set: model with higher number, model with lower number, speed, and RAM."

my query:
SELECT MAX(p1.model) AS model, MIN(p2.model) AS model, p1.speed, p1.ram
FROM PC AS p1, PC p2
WHERE p1.speed = p2.speed AND p1.ram = p2.ram AND p1.model != p2.model
GROUP BY p1.ram, p1.speed


result answer:
"Your query produced correct result set on main database, but it failed test on second, checking database."

if you can feel in your own way it means that you are a human not the "people" and life becomes the most boring thing in life

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2011-01-17 : 01:56:44
well what do you mean by the word Failed, Explain it. e.g. does this query return any error on the other Database?
Go to Top of Page

balulilu
Starting Member

2 Posts

Posted - 2011-01-17 : 03:35:32
well, I did not said that I failed, I said that my query returns correct results but the system does not accepts.

there is a sample of requested answer:
The result of correct query:
model	model	speed	ram
1233 1121 750 128
1233 1232 500 64
1260 1232 500 32


my query returns exactly the same answer but still system does not accepts it :@ as I already wrote it says:
quote:
"Your query produced correct result set on main database, but it failed test on second, checking database."


I'm very confused, what the hell is main and second DBs ? o_O o_O o_O



if you can feel in your own way it means that you are a human not the "people" and life becomes the most boring thing in life
Go to Top of Page
   

- Advertisement -