Skip to main content
Participant
May 1, 2008
Question

recordcount & IF statement problem

  • May 1, 2008
  • 1 reply
  • 247 views
Hi
I am trying to create a summary page for a questionnaire.
I need to count the number of same values in a column, so if there are 3 "1s" the return will be 3.
I'm using the following code

<cfoutput query="qcount"><cfif s1q1 IS 1>#qcount.recordcount#</cfif></cfoutput>

This returns the amount of "1s" but repeats as many times as there are "1's" in the column; so if there are 3 "1s" I get 333
How can I stop this? I want to avoid using multiple queries as there are lots of questions and want to keep the code as short as possible.
Thanks
Michael
This topic has been closed for replies.

1 reply

Inspiring
May 1, 2008
select something, count(something) thecount
from etc
where etc
group by something