as无效 mysql_MySQL:无效使用组函数

我正在使用MySQL。这是我的架构:

供应商(sid:整数,sname:字符串,地址字符串)

零件(pid:整数,pname:字符串,color:字符串)

目录(sid:整数,pid:整数,成本:实数)

(主键以粗体显示)

我正在尝试编写查询以选择至少两个供应商制造的所有零件:

-- Find the pids of parts supplied by at least two different suppliers.

SELECT c1.pid                      -- select the pid

FROM Catalog AS c1                 -- from the Catalog table

WHERE c1.pid IN (                  -- where that pid is in the set:

SELECT c2.pid                  -- of pids

FROM Catalog AS c2             -- from catalog

WHERE c2.pid = c1.pid AND COUNT(c2.sid) >= 2 -- where there are at least two corresponding sids

);

首先,我什至会以正确的方式这样做吗?

其次,我得到这个错误:

1111-无效使用组功能

我究竟做错了什么?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值