Count distinct values of a column and insert them to another table
Try using 

SUM(Case WHEN problem Like '%err1%' THEN 1 ELSE 0 END) //for problem count


'%err1%' is a sample error containing letter to rectify which error is this.