I am trying to count 5 categories, which will be based on the errorcode that has the most values. (eg errorcode1 was chosen 10 times, errocode2 was chosen 3 times all for category1, then the image in the cell next to category 1 should be red, because errorcode1 contained the most values for that category.

eg of how the webpage looks:
(5 categories, 5 errorcodes, 3 images for colorcode)

Ticket_view
Category 1 --> errorcode1(10) red
Category 2 --> errorcode2 (6) yellow
Category 3 --> errorcode3 (5) yellow
Category 4 --> errorcode4 (3) green
Category 5 --> errorcode5 (1) green

Color_code.dbo
legend:
green - 0-3 errors
yellow - 4-6 errors
red - 7+ errors

"SELECT category, COUNT(errorcode) AS id_number FROM ticket_view GROUP BY category"