SELECT count(*)
FROM tb_Deficiency
LEFT JOIN tb_DeficiencyAssignment 
ON tb_Deficiency.col_DeficiencyID = tb_DeficiencyAssignment.col_DeficiencyID
WHERE tb_Deficiency.col_CompletedDate = '0000-00-00'
AND (tb_DeficiencyAssignment.col_CompanyName IS NULL
OR tb_DeficiencyAssignment.col_CompanyName = '')
AND tb_Deficiency.col_Centre LIKE '$var_Centre'
