SQL: Totaling A Column Containing Varying Values
Submitted by jacob on Wed, 06/14/2006 - 9:47amI have been doing quite a few surveys recently and one of the tasks involved is mining the responses for data. Here's a neat trick I learned for totalling and counting responses using sql rather than programmatically on the front end.
Let's say you have a table of customers (tblCustomers) that houses the name of each person and the flavor of ice cream each customer prefers: