I'm doing select with case comparing different statuses of the same field and counting them in separate columns. The problem is that the first column gets NULL
until the list of the second ends the count. Then this is reversed.
My query is as follows:
select
case when cor.status = 35 then count(cor.uid) end as finalizadas,
case when cor.status = 50 then count(cor.uid) end as canceladas_motorista,
mot.nome || ' ' || mot.sobrenome as nome,
mot.celular,
mot.email
from motoristas mot, corridas cor
where...
follows the result example:
Any help, please?