MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old June 22nd, 2000, 09:14 AM
nils.hulth nils.hulth is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 3 nils.hulth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old June 22nd, 2000, 09:21 AM
pwluky pwluky is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 109 pwluky User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Can you give the exact desciption of your table??

Reply With Quote
  #3  
Old June 22nd, 2000, 10:03 AM
nils.hulth nils.hulth is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 3 nils.hulth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
<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.

Reply With Quote
  #4  
Old June 22nd, 2000, 12:23 PM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 13
Send a message via AIM to rod k
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.

Reply With Quote
  #5  
Old June 22nd, 2000, 02:36 PM
nils.hulth nils.hulth is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 3 nils.hulth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.


Reply With Quote
  #6  
Old June 22nd, 2000, 03:16 PM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 13
Send a message via AIM to rod k
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Query question - difficult or am I dumb?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway