【发布时间】:2020-08-07 08:40:13
【问题描述】:
Print name of all activities with neither maximum nor minimum number of participants
我尝试了以下查询,但给了我错误:
select ACTIVITY
from (select ACTIVITY, count(*) as cnt,
max(count(*)) as max_cnt,
min(count(*)) as min_cnt
from FRIENDS GROUP BY ACTIVITY) FRIENDS
where cnt not in (max_cnt, min_cnt);
ERROR: ERROR 1111 (HY000) at line 1: 无效使用组函数 MYSQL 版本:8
【问题讨论】:
-
版本 14?我严重过时了
标签: mysql sql group-by count greatest-n-per-group