获取错误错误:位置:98 中不允许聚合函数



我试图找到我尝试过的minimumcustomer

select info->'customer'
from orders
where cast(info->'items'->>'qty' as INTEGER) =
(select min(cast(info->'items'->>'qty' as INTEGER)))

这是我的代码

http://sqlfiddle.com/#!17/79606/17

获取错误:聚合函数不允许在 WHERE 位置:98

预期答案 "乔什·威廉">

您的子查询缺少FROM子句。尝试:

select info->'customer'
from orders
where cast(info->'items'->>'qty' as INTEGER) =
(select min(cast(info->'items'->>'qty' as INTEGER))
from orders)