I need help using the SQL counting function with SQL server 2000. Here is what I have been trying to get it to do and I have been failing.
I have a table that has 8 rating columns inside of it. By rating columns I mean that these columns store a rating number from 1 to 5 that rates personel on how well they are doing their jobs. I want to be able to use one sql statement that will give me 40 fields back (8x5) so that I can have a count of how many 1's and 2's etc... each person has. Is this do-able? This code will work for one of the columns but I want to be able to do all 8 at once.
SELECT tr_experience, COUNT(tr_trainer) AS Expr1
FROM evaluation
WHERE (tr_trainer = 3)
GROUP BY tr_experience
If anyone has any answers for me they would be greatly appreciated!
Thanks,
Ryan Smallegan
Web Developer
I have a table that has 8 rating columns inside of it. By rating columns I mean that these columns store a rating number from 1 to 5 that rates personel on how well they are doing their jobs. I want to be able to use one sql statement that will give me 40 fields back (8x5) so that I can have a count of how many 1's and 2's etc... each person has. Is this do-able? This code will work for one of the columns but I want to be able to do all 8 at once.
SELECT tr_experience, COUNT(tr_trainer) AS Expr1
FROM evaluation
WHERE (tr_trainer = 3)
GROUP BY tr_experience
If anyone has any answers for me they would be greatly appreciated!
Thanks,
Ryan Smallegan
Web Developer