Skip navigation
Merle_Hanson
Currently Being Moderated

Get Results For Most Wrong Answers

Apr 10, 2012 12:30 PM

I've googled this to death and can't seem to get the right output...

 

I can get it close with the right amount of no answers for each question...

But I can't order it correctly by most answered no...

 

Any help is appreciated...

 

Basically I want to order them by the most amount of no answers first... etc...

 

Coding below gets me the proper output - but not ordered by most...

Changing to order by recordcount or QCount errors...

 

cfquery name="allans" datasource="#ds#">
SELECT
qid, count(qid) as Qcount
FROM answer
where answer = 'no'
GROUP BY qid
ORDER BY qid
cfquery>

<cfoutput query="allans" group=qid>    
<hr>#qid# - #QCount#<br>    
</cfoutput>

 

ColdFusion8 - MS Access Database

 

Any help is appreciated thx...

 
Replies
  • Currently Being Moderated
    Apr 10, 2012 1:10 PM   in reply to Merle_Hanson

    Well, take a look at your query - you're saying the value you want to order by is count(qid), is that right?

     

    If so:

     

         GROUP BY count(qid) DESC

     

    Should do you. Unless I've misunderstood?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 10, 2012 3:05 PM   in reply to Merle_Hanson

    Sorry, that was a brain>fingers error, clearly order by not group by!

     

    Glad you got it sorted.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points