sql - 收到错误错误:在 WHERE 位置中不允许使用聚合函数:98
问题描述
我试图找到我这样尝试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 Position: 98 中不允许使用聚合函数
预期答案“乔什·威廉”
解决方案
您的子查询缺少一个FROM
子句。尝试:
select info->'customer'
from orders
where cast(info->'items'->>'qty' as INTEGER) =
(select min(cast(info->'items'->>'qty' as INTEGER))
from orders)
推荐阅读
- c++ - 为什么 std::is_same 对这两种类型给出不同的结果?
- php - Xdebug,不能接受外部 xdebug 连接。局部值覆盖主控
- excel - Vba 错误处理和类 (Excel)
- qt - androiddeployqt 找不到 ant 错误,但可以与 Qt Creator 一起使用
- mysql - 如何在网上商城的mysql中管理refunds db表?
- javascript - javascript中console.log和运算符类型的工作以及javascript中类型转换的示例
- sql - 在同一过程中设置两个行源非常慢 - Access 2010
- jquery - 需要 Jquery 帮助 - 2 点击 2 功能
- c# - C# 8 位置模式与解构模式
- gitlab - gitlab pages : 用于 certbot 挑战的特殊 webroot