Try this:
SELECT
CASE
WHEN Count(e1.ErrorCode) <= 3 Then Green
WHEN Count(e1.ErrorCode) > 3 AND Count(e1.ErrorCode) <= 6 Then Yellow
WHEN Count(e1.ErrorCode) > 6 Then Red
END as [Category 1],
CASE
WHEN Count(e2.ErrorCode) <= 3 Then Green
WHEN Count(e2.ErrorCode) > 3 AND Count(e2.ErrorCode) <= 6 Then Yellow
WHEN Count(e2.ErrorCode) > 6 Then Red
END as [Category 2]
FROM ticket_view e1
Left Join ticket_view e2 on e2.category = 'Category 2'
WHERE e1.category = 'Category 1'
Obviously you would wnat to join 3 more times to get the last 3 categories but you get the idea. The column name will be your category and the value of that column will be a color.
HTH.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========