SELECT count(*) 
FROM tb_Deficiency
LEFT JOIN tb_ListDeficiencyType ON tb_ListDeficiencyType.col_DeficiencyType = tb_Deficiency.col_DeficiencyType
WHERE tb_Deficiency.col_CompletedDate = '0000-00-00' 
AND (tb_Deficiency.col_Seasonal IS NULL OR tb_Deficiency.col_Seasonal <> 'Yes') 
AND (to_days(current_date) - to_days(tb_Deficiency.col_ReportedDate)) >= tb_ListDeficiencyType.col_DaysWarning
AND tb_Deficiency.col_Centre LIKE '$var_Centre'
