If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Calculate Top 12 from each group and rank the group

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-07-12, 12:09
dhascup dhascup is offline
Registered User
 
Join Date: Aug 2012
Posts: 2
Calculate Top 12 from each group and rank the group

My results database has about 10,000 records.
Each "GROUP" could have anywhere from 8 to 30 records.
I need to grab the top 12 records from each GROUP, grab the total of the top 12 records and then rank the group by that total

Example database
Quote:
BOB 10
BOB 11
BOB 14
BOB 16
BOB 13
BOB 18
SAM 15
SAM 12
SAM 17
SAM 11
SAM 10
SAM 13
JOE 15
JOE 12
JOE 17
JOE 11
JOE 10
JOE 13
BILL 10
BILL 11
BILL 11
BILL 16
BILL 12
BILL 14
MIKE 11
MIKE 12
MIKE 10
MIKE 19
MIKE 11
MIKE 11
So the overall rankings would be
Quote:
Bob = 82
Sam = 78
Joe = 78
Bill = 78
Mike = 78
For example, I will just assume we want the top 3 points
I need the REVISED RANKINGS to show
Quote:
Bob = 34
Sam = 32
Joe = 32
Mike = 31
Bill = 30
Can someone point me in the correct direction to do this?

Regards,
David
Reply With Quote
  #2 (permalink)  
Old 08-07-12, 14:34
papadi papadi is offline
Registered User
 
Join Date: Oct 2009
Location: 221B Baker St.
Posts: 483
Please show how the "top 3 points" was determined. I don't see how BOB was found to be 34.

I am probably missing something.
Reply With Quote
  #3 (permalink)  
Old 08-07-12, 14:37
dhascup dhascup is offline
Registered User
 
Join Date: Aug 2012
Posts: 2
I apologize. My example should be top 2
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On