★ wanayoo — archive 1999 http://www.devshed.com/Talk/Forums/Forum4/HTML/000618.htmlNouvelle recherche | Portail wanayoo
DevShed Menu
* DevShed Home
* Developer News
* DevShed Brain Dump




UBBFriend: Email This Page to Someone!
  DevShed Discussion Forums
  MySQL
  Query question - difficult or am I dumb?

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   Query question - difficult or am I dumb?
nils.hulth
Junior Member
posted June 22, 2000 08:14 AM     Click Here to See the Profile for nils.hulth   Click Here to Email nils.hulth     Edit/Delete Message Reply w/Quote
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

pwluky
Member
posted June 22, 2000 08:21 AM     Click Here to See the Profile for pwluky   Click Here to Email pwluky     Edit/Delete Message Reply w/Quote
Can you give the exact desciption of your table??

nils.hulth
Junior Member
posted June 22, 2000 09:03 AM     Click Here to See the Profile for nils.hulth   Click Here to Email nils.hulth     Edit/Delete Message Reply w/Quote
quote:
Originally posted by pwluky:
Can you give the exact desciption of your table??

It's simple, just an ID and a score column.

rod k
Member
posted June 22, 2000 11:23 AM     Click Here to See the Profile for rod k   Click Here to Email rod k     Edit/Delete Message Reply w/Quote
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.

nils.hulth
Junior Member
posted June 22, 2000 01:36 PM     Click Here to See the Profile for nils.hulth   Click Here to Email nils.hulth     Edit/Delete Message Reply w/Quote
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.

rod k
Member
posted June 22, 2000 02:16 PM     Click Here to See the Profile for rod k   Click Here to Email rod k     Edit/Delete Message Reply w/Quote
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.

All times are MST (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | DevShed.com

Copyright © 1997-2000 ngenuity. All rights reserved.

Powered by: Ultimate Bulletin Board, Version 5.41a
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 1999.