Best unofficial Apache Server developers community |
|
My question is Write an SQL query that will determine which is the least expensive venue that will accommodate 120 people. The Code i wrote
I am still getting both the answers and not the Least one. But if i remove V.venueName from the select function.....i get the correct answer! Why is that so ? Your help would be highly appreciated. Thanks
posted via StackOverflow
|
|
 
|
Or using a subselect:
You might want to use venuecapacity |
|
 
|
|
|
 
|
That is because you select the lowest cost per day per venue if you include the name. In fact, the whole grouping is useless in this table as long as venuename is unique. To get the venue with the lowest price use something like this:
|
|
 
|
I think this might be what you want:
Use >= 120, because you might not have any venues that have exactly 120 capacity, and you want all venues that can handle at least 120. Your requirements only state that the venue be able to accommodate 120 people, not that it handle exactly 120 people. |
![]()  
|
You include the same field in the select list, thus the min will be computed for each of them not overall items |