473,408 Members | 1,852 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Top Values for Each Student

Access 2000

I need a query to return the Sum of the TOP 15 values for each student.
This is to rank the students according to the sum of thier best 15
scores. Each student could have any number of scores. Ex: Dave has 55
scores, Mike has 24 scores, Sam has 12 scores, ....

I can get the Top 15 for the overall table, but I am having trouble
obtaining the above result.

I have a query that contans the student, P1,P2,P3,P4,P5, RdTotal.
P1-P5 are individual scores for the 5 parts of the round and RdTotal is
a calulated field showing the Sum of P1-P5.
Thanks
Dale

Feb 5 '06 #1
1 1538
mt****@yadtel.net wrote in
news:11**********************@o13g2000cwo.googlegr oups.com:
Access 2000

I need a query to return the Sum of the TOP 15 values for each
student.
This is to rank the students according to the sum of thier
best 15
scores. Each student could have any number of scores. Ex:
Dave has 55 scores, Mike has 24 scores, Sam has 12 scores,
....

I can get the Top 15 for the overall table, but I am having
trouble obtaining the above result.

I have a query that contans the student, P1,P2,P3,P4,P5,
RdTotal. P1-P5 are individual scores for the 5 parts of the
round and RdTotal is a calulated field showing the Sum of
P1-P5.
Thanks
Dale


It's not clear which field becomes the source for the top 15
scores. Is it rdTotal?

Anyways, the trick to doing something like you want is to
generate the sum of the top 15 using nested sub-queries.

Looks ugly, have not tested it, but this should work

SELECT DISTINCT x.student, (SELECT sum(rdTotal) from (SELECT top
15 y.rdtotal From scoretable as y WHERE y.RdTotal = x.rdtotal
ORDER BY y.RdTotal desc)) as SumTopScores from scoretable as x;

Build the inner query first, test, and then place in the outer
query.

--
Bob Quintal

PA is y I've altered my email address.
Feb 5 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: CSDunn | last post by:
Hello, I have a table called 'tblCLTestScores' that holds student test scores for one particular test. Students take this same test three times on different dates, so the table contains three or...
1
by: Jarle Presttun | last post by:
Hi, Sometimes I display values by combining information from different sections in the xml, like I do with gradeText in the student template bellow. Is it possible to sort on gradeText when I...
5
by: david hepworth | last post by:
Hi All I will try to explain my problem. I am wishing to apply a template to the following XML. There are multiple event nodes within the register root node. For each of the event nodes there...
1
by: medhanush | last post by:
Hi, I have data as follows Student City Marks -------- ----- ----- StudentA CityA 75 StudentA CityA 80 StudentA CityA 81 StudentB CityB 79 StudentB CityB 75
1
by: Muhammad Usman | last post by:
hi, I have a table of student which contain four fields that are id(primary key number) , name(text),semester(text)and corse(text), When I insert values in a student table.Explorer Show the...
5
by: Bill | last post by:
Can I do this in one SQL statement? If so, please tell me how. I have wasted a ton of time on this but there has to be an easy way to do it. I should have done it with more than one statement...
2
by: phillip.s.powell | last post by:
This is what I tried: update student_db.student set activities = (select i.activities from client.student c, student_db.student s where c.unique_key = s.unique_key); ERROR 1093 (HY000): You...
23
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these...
0
by: fatesgrasp | last post by:
Hi. I have an asp page which is connects to an access database from which it loops through a recordset to create a checkbox for each record. I have a script that's suppose to calculate a total value...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.