小编faz*_*aza的帖子

如何修复错误“WHERE 中不允许使用聚合函数”

如何解决此错误

Err] 错误:WHERE 中不允许使用聚合函数

这是我的查询

select count(case daftar.daftar when 'sd' then 1 else null end) as sd,
 count(case daftar.daftar when 'smp' then 1 else null end) as smp,
 count(case daftar.daftar when 'sma' then 1 else null end) as sma
from daftar
join gelombang on  daftar.gel=gelombang.id
join ajaran on ajaran.id=gelombang.id_ajar
join tahun on tahun.id=ajaran.tahun
where daftar.status='terima' and daftar.pindahan='no' and tahun.id= max(tahun.id)
Run Code Online (Sandbox Code Playgroud)

postgresql

8
推荐指数
2
解决办法
2万
查看次数

标签 统计

postgresql ×1