Thanks Steve!

Here is my final query that worked:

select increasedKnowledge,
Sum(case increasedKnowledge WHEN 'agree' then 1 else 0 end) as 'agree', 
Sum(case increasedKnowledge WHEN 'disagree' then 1 else 0 end) as 'disagree', 
Sum(case increasedKnowledge WHEN 'Neither Agree nor Disagree' then 1 else 0 
end) as 'Neither Agree nor Disagree', 
Sum(case increasedKnowledge WHEN 'strongly agree' then 1 else 0 end) as 
'strongly agree', 
Sum(case increasedKnowledge WHEN 'Strongly Disagree' then 1 else 0 end) as 
'Strongly Disagree'
FROM  evaluationReponsesCourse13 
group by increasedKnowledge
order by increasedKnowledge



>Your task shouldn't be to handle values that were not returned from the
>query. You need to think of a way to make sure they are returned. You
>should be able to accomplish that by using case statements in your query.
>Syntax may vary depending on your database, but should be something like
>this (assume you db field is called "response"):
>
>Sum(case response = 'agree' then 1 else 0 end) as agree,
>Sum(case response = 'disagree' then 1 else 0 end) as disagree,
>Sum(case response = 'strongly agree' then 1 else 0) as strongly_agree
>
>And so on for each possible value. Your resultset will then contain a total
>for each possible value, and a 0 if a value wasn't found at all.
>
>
>
>> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:359825
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to