SELECT tb_Deficiency.col_DeficiencyType, COUNT(DISTINCT tb_Deficiency.col_DeficiencyID) 
FROM tb_Deficiency
LEFT JOIN tb_ListDeficiencyType ON tb_ListDeficiencyType.col_DeficiencyType = tb_Deficiency.col_DeficiencyType
WHERE tb_Deficiency.col_CompletedDate <= CURDATE()
AND tb_Deficiency.col_CompletedDate >= (CURDATE() - INTERVAL 7 DAY)
AND tb_Deficiency.col_Centre LIKE '$var_Centre'
GROUP BY tb_Deficiency.col_DeficiencyType
ORDER BY COUNT(DISTINCT tb_Deficiency.col_DeficiencyID) DESC
LIMIT 5
