Fix must appear in the GROUP BY clause or be used in an aggregate function
<pre><code>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
</code></pre>

<p>and result error </p>

<blockquote>
  <p>[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 ...</p>
</blockquote>

<p>I'm trying same query in MySQL and no error and success grouping
how to use group by in PostgreSQL?</p>

<p>I want to group by <code>tahun</code>.</p>

<p>This is my table.</p>

<p><img src="https://i.stack.imgur.com/6un2P.jpg" alt="this my table"></p>