zeewagon
zeewagon

Reputation: 2033

argument of HAVING must be type boolean, not type integer

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

Answers (2)

Gordon Linoff
Gordon Linoff

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

Andomar
Andomar

Reputation: 238048

select  place
from    studies
where   cost = 
        (
        select  max(cost)
        from    studies
        )

Upvotes: 3

Related Questions