HAVING 的参数必须是布尔类型,而不是整数类型
argument of HAVING must be type boolean, not type integer
我正在上 table 课程
和列 place 和 cost 超过两行。
我希望我的查询显示费用最高的课程。
我尝试使用以下查询
select splace
from studies
group by splace
having max(ccost);
并得到错误 argument of HAVING must be type boolean, not type integer
我犯了什么错误?正确的查询是什么?
select place
from studies
where cost =
(
select max(cost)
from studies
)
如果你只想要一行,那么你可以使用limit
和order by
:
select place
from studies
order by cost desc
limit 1;
我正在上 table 课程 和列 place 和 cost 超过两行。
我希望我的查询显示费用最高的课程。 我尝试使用以下查询
select splace
from studies
group by splace
having max(ccost);
并得到错误 argument of HAVING must be type boolean, not type integer
我犯了什么错误?正确的查询是什么?
select place
from studies
where cost =
(
select max(cost)
from studies
)
如果你只想要一行,那么你可以使用limit
和order by
:
select place
from studies
order by cost desc
limit 1;