Closed Juary88 closed 6 years ago
Hi @Juary88
The output is
(product) Name MAX(Price) (manufacturer)Name
DVD drive 180 Creative Labs
Hard drive 240 Fujitsu
Printer 270 Hewlett-Packa
ZIP drive 150 Iomega
Monitor 240 Sony
Memory 120 Winchester
And it looks correct to me. May you clarify a bit more about your question?
Thanks.
Actually the product name does not match the price if you change max function to the min.
But the question itself is "-- 1.16 Select the name of each manufacturer along with the name and price of its most expensive product."?
Because you just meet the right answer,if you chang the sequence of the name,your answer is wrong
I guess what you wanted to say is 瞎猫撞上死耗子? LOL
May you provide a minimal reproducible sample? Not sure what you meant by "change the sequence of the name".
Thanks.
For instance,if I change the price of Memory 120 to 4,your answer is: The product name does not change.
but the right answer is:
and two products have the same price,you should both show them.
所以你想指出的问题是应该把“Creative Labs”下属两个同样价钱(同时也是最贵)的产品同时列出来,而不是你最开始说的“Your answer always showes the wrong product name to match the price.”?如果这样的话我也不太理解为什么要把Memory的价钱改到4才能复现这个问题?
会做相应的修改。谢谢。
Addressed in e05d781341c3791951ddf54c94ee32ca11cf5896
it should be : select p.name,m.name,p.price from products p join manufacturers m on p.manufacturer = m.code where p.price in ( select min(a.price) from Manufacturers b join Products a on a.Manufacturer = b.code group by b.name); Your answer always showes the wrong product name to match the price.