I have a problem with my query. Here's my code:
select kpidate,reviewer as namareviewer,
count(formcode) as actual,
round((0.2*count(formcode))) as target,
CASE WHEN blibliknowledge !=''
THEN count(blibliknowledge)
END as blibli,
CASE WHEN solusi !=''
THEN count(solusi)
END as solusi
from kpi
where kpidate >= '30/11/2015' AND kpidate<= '1/12/2015'
group by reviewer,kpidate,blibliknowledge,solusi
I have to add the columns blibliknowledge
and solusi
because of the CASE
expression, and the output would be like this:
I want to group by namareviewer
so 'elbert.lukman' will be grouped. So the output is just two rows. Column blibli
and solusi
will be calculated too as group by namareviewer.