Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
anishap
Yak Posting Veteran
61 Posts |
Posted - 2008-10-08 : 15:29:40
|
I have a table with the below data:ID Cat Rat Rabbits001 A B D002 A C E003 B A A004 A E B005 D A B006 B C AI want to count the # of A,B,C,D and E's from each column.SELECT cat,sum(Abs(cat="A" or "B" or "C" or "D")) as Cat_Tot from sample group by cat. The above query works for single column.Output sample.Cat Count Rat Count Rabbits CountA 2 A 2 A 1B 2 B 1 C 2Can anyone help with this please? |
|
|
|
|