SELECT tb_DeficiencyAssignment.col_CompanyName, COUNT(DISTINCT tb_Deficiency.col_DeficiencyID) 
FROM tb_Deficiency, tb_DeficiencyAssignment 
WHERE tb_Deficiency.col_DeficiencyID = tb_DeficiencyAssignment.col_DeficiencyID 
AND tb_Deficiency.col_DeficiencyType = '1 Year' 
AND tb_Deficiency.col_CompletedDate = '0000-00-00' 
AND tb_DeficiencyAssignment.col_CompletedDate = '0000-00-00' 
AND tb_Deficiency.col_Centre LIKE '$var_Centre'
GROUP BY tb_DeficiencyAssignment.col_CompanyName 
ORDER BY COUNT(DISTINCT tb_Deficiency.col_DeficiencyID) DESC, tb_DeficiencyAssignment.col_CompanyName LIMIT 5
