我有一个问题时,数据为空,并出现警告时,结果显示。 How to solve this problem?. How to change the null data to 0 when no data in the table?.
这是我的代码:-
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
结果是这样的:-
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)