Reputation: 2033
I am having a table course and columns as place and cost with more than two rows.
I want my query to display the course which has the highest cost. I tried with the below query
select splace
from studies
group by splace
having max(ccost);
and got the error as argument of HAVING must be type boolean, not type integer
What mistake I have done? And What would be the correct query?
Upvotes: 0
Views: 2910
Reputation: 1269445
If you only want one row, then you can use limit
and order by
:
select place
from studies
order by cost desc
limit 1;
Upvotes: 0
Reputation: 238048
select place
from studies
where cost =
(
select max(cost)
from studies
)
Upvotes: 3