請幫我如何解決必須出現在GROUP BY子句或聚合函數中使用
我newbi在Postgres數據庫
select
case
when daftar ='sd' then kouta
end as a,
case
when daftar = 'smp' then kouta
end as b,
case
when daftar = 'sma' then kouta
end as c
from
ajaran
GROUP BY
tahun
和結果誤差
[Err] ERROR: column "ajaran.daftar" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: select case when daftar='sd' then kouta end as a,case when ...
我想在MySQL中查詢相同的查詢,並且沒有錯誤和成功分組 如何在pgsql中使用group by?
我想按tahun
MySQL是不正確的,讓無差錯運行查詢,但MySQL是比PostgreSQL的那麼嚴格(和大多數其他數據庫系統,真的)。 – Dai
你期望輸出什麼數據?你知道'GROUP BY'是什麼意思嗎?在這種情況下,「tahun」是什麼意思?它與「kouta」有什麼關係? – Dai