Tenho um problema quando os dados são nulos e o aviso aparece quando o resultado é exibido. Como resolver este problema?. Como alterar os dados nulos para 0 quando não há dados na tabela ?.
Este é o meu código: -
SELECT DISTINCT c.username AS assigner_officer,
d.description AS ticketcategory,
(SELECT Count(closed)
FROM ticket
WHERE assigned_to = c.user_id
AND closed IS NOT NULL
GROUP BY assigned_to)closedcases,
(SELECT Count(closed)
FROM ticket
WHERE assigned_to = c.user_id
AND closed IS NULL
GROUP BY assigned_to)opencases
FROM ticket a
JOIN ticketlog b
ON a.ticketid = b.ticketid
JOIN access c
ON a.assigned_to = c.user_id
JOIN ticket_category d
ON a.cat_code = d.id
JOIN lookup_department e
ON a.department_code = e.code
O resultado aparece assim: -
Warnings: --->
W (1): Warning: Null value is eliminated by an aggregate or other SET operation.
<---
assigner_officer ticketcategory closedcases opencases
------------------- ----------------- -------------- ------------
abdulhafiz Enquiry (null) 0
affan Enquiry 12 (null)
amirul Enquiry 1 (null)
azrul_fahmi Enquiry 45 0
Azwani Enquiry (null) 0
chai Enquiry 4 (null)
dalinawati Enquiry 1 0
Emmy Complaints (null) 0
Fadhlia Enquiry 38 0
fairulhalif Others 1 (null)
farikh Enquiry (null) 0
ismailh Enquiry 28 0
izzahanna Enquiry (null) 0
Kamsuzilawati Enquiry 1 (null)
Count(closed) ... WHERE ... closed IS NULL
não faz nenhum sentido, poisCOUNT
apenas contaNOT NULL
valores