|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
Hi,
I have a table with thousands of assessment results in the range 0-66, that I'd like to calculate some statistics for. The format I'd like is: Score Frequency 0 4.5% 1-3 6.8% 4-6 4.2% . . . . 64-66 0.7% Is this possible to do within a single query, or do I need another helping table with the ranges? Any help appreciated! /Nils |
|
#2
|
|||
|
|||
|
Can you give the exact desciption of your table??
|
|
#3
|
|||
|
|||
|
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by pwluky:
Can you give the exact desciption of your table??[/quote] It's simple, just an ID and a score column. |
|
#4
|
|||
|
|||
|
select score,count(*) from table group by score;
This will return a result set where each row contains a score and the number of rows where that score is entered. |
|
#5
|
|||
|
|||
|
Yeah, I've tried that, but you see I don't want it by single scores, I want them group by intervals, like all scores between 1 and 3 counted together.
|
|
#6
|
|||
|
|||
|
Then you'll have to manually add the groupings together with a script, which should be quite easy. I can't think of any possible ways to group them together like that with a single query and multiple queries wouldn't be wise from a performance standpoint.
|
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > Query question - difficult or am I dumb? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|