Good morning,
I need a help from you, I have a query on my system that has a problem, it has 4 results, only 1 of those 4 is coming with null value.
I'm going to post my query below
SELECT Title, SUM(Count) AS Count
FROM (
SELECT
CASE WHEN EstadoId = EstadoIdAutor AND EstadoId = Meddoc1 AND EstadoId = Meddoc2 AND EstadoId = Meddoc3 THEN
'Sem deslocamento'
ELSE CASE WHEN EstadoId = EstadoIdAutor AND (EstadoId = Meddoc1 OR EstadoId = Meddoc2 OR EstadoId = Meddoc3) THEN
'Fora de domicílio do autor'
ELSE CASE WHEN EstadoId <> EstadoIdAutor OR (EstadoId = EstadoIdAutor AND (EstadoId <> Meddoc1 AND EstadoId <> Meddoc2 AND EstadoId <> Meddoc3)) THEN
'Mais de um deslocamento'
END
END
END AS Title,
COUNT(*) AS Count
FROM jud_Processos
WHERE Status = 1 AND Trancado = 1
GROUP BY EstadoId, EstadoIdAutor, Meddoc1, Meddoc2, Meddoc3
) Sub
GROUP BY Title
can anybody help me? Where NULL is Other