SELECT e.*, COALESCE(SUM(d.`count`),0) `SUM of count`
FROM
(
SELECT c.detectDate, a.infection
FROM
(
SELECT DISTINCT infection
FROM tbl_correlateddata
) a CROSS JOIN
(
SELECT DISTINCT DATE(detectDate) detectDate
FROM tbl_correlateddata
) c
) e LEFT JOIN tbl_correlateddata d
ON DATE(d.detectDate) = e.detectDate AND
d.infection = e.infection
GROUP BY detectDate, infection
ORDER BY e.detectDate, e.infection
or
SELECT DATE_FORMAT(e.detectDate, '%Y-%m-%d' ),
e.infection,
COALESCE(SUM(d.`count`),0) `SUM of count`
FROM
(
SELECT c.detectDate, a.infection
FROM
(
SELECT DISTINCT infection
FROM tbl_correlateddata
) a CROSS JOIN
(
SELECT DISTINCT DATE(detectDate) detectDate
FROM tbl_correlateddata
) c
) e LEFT JOIN tbl_correlateddata d
ON DATE(d.detectDate) = e.detectDate AND
d.infection = e.infection
GROUP BY e.detectDate, e.infection
ORDER BY e.detectDate, e.infection