473,320 Members | 1,947 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,320 software developers and data experts.

Calculating Positions Query Required...........

AA Guyz i want to calculate class position of students from a table.
Sample data is as follows...

Roll # - Name - Marks
1 - ABC - 60
2 - DEF - 60
3 - GHI - 57
4 - JKL - 55
5 -MNO - 50
6 -PQR - 53

The query should return the following result.

Roll # - Name - Marks - POSITION
1 - ABC - 60 - 1
2 - DEF - 60 - 1
3 - GHI - 57 - 3
4 - JKL - 55 - 4
5 -MNO - 50 - 5
6 -PQR - 53 - 6

I want query in MS SQL Server 2000

Aug 31 '06 #1
1 1552
--[zainy]-- wrote:
AA Guyz i want to calculate class position of students from a table.
Sample data is as follows...

Roll # - Name - Marks
1 - ABC - 60
2 - DEF - 60
3 - GHI - 57
4 - JKL - 55
5 -MNO - 50
6 -PQR - 53

The query should return the following result.

Roll # - Name - Marks - POSITION
1 - ABC - 60 - 1
2 - DEF - 60 - 1
3 - GHI - 57 - 3
4 - JKL - 55 - 4
5 -MNO - 50 - 5
6 -PQR - 53 - 6
Try the following:

select a.roll, a.name, a.marks, count(*) + 1 position
from table a
left join table b on b.marks a.marks
group by a.roll, a.name, a.marks
Aug 31 '06 #2

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

Similar topics

13
by: racygirl | last post by:
Hi all, I was just wondering, is it possible to write a solution to the following problem with the following criteria: 1. it must be as efficient as possible at run-time 2. be in O(1) 3. and...
0
by: pbrletic | last post by:
I am seeking a person with the following qualifications for permanent position with a large real estate services company located in Mt. Laurel, NJ. Job Description: Web Systems Analyst to...
5
by: jonm4102 | last post by:
I'm trying to calculate the median of some numerical data. The data can only be found in a query (henceforth query 1) field I previously made, and I would prefer to calculate the median in a new...
0
by: jimmy Zhang | last post by:
Hi, We are developers of VTD-XML (http//vtd-xml.sf.net) and we are interested in your opportunities...are you still having those positions open? Jimmy Zhang <gaetan@hains.orgwrote in message...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.