我试图找到customer
值的minimum
我试过这样
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中不允许聚合函数
预期答案“Josh William”
你的子查询错过了FROM
条款。尝试:
select info->'customer'
from orders
where cast(info->'items'->>'qty' as INTEGER) =
(select min(cast(info->'items'->>'qty' as INTEGER))
from orders)