我试图找到我尝试过的minimum
值customer
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)