Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Help with difficult query

2 posts in General Discussion Last posting was on 2009-11-22 09:06:37.0Z
Yaniv C. Posted on 2009-11-22 08:40:16.0Z
Sender: 1051.4b08f847.1804289383@sybase.com
From: Yaniv C.
Newsgroups: sybase.public.ase.general
Subject: Help with difficult query
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4b08f8f0.1069.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 22 Nov 2009 00:40:16 -0800
X-Trace: forums-1-dub 1258879216 10.22.241.41 (22 Nov 2009 00:40:16 -0800)
X-Original-Trace: 22 Nov 2009 00:40:16 -0800, 10.22.241.41
Lines: 41
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28671
Article PK: 77913

Hi
I am trying to write the query for that and cannot.
(ASE 15)
Any ideas?
Here is the problem:

Demand:
retrieve a single! student id
from each class that got the highest score

For example:
class_id student_id score
1 100 10
1 200 20
2 300 40
2 400 30
3 500 50
3 600 50

Desire result:
200
300
500
Or
200
300
600

Wrong result:
200
300
500
600

Although 500 and 600 got the same score (50), just one
sudent can be from single class
it can be student 500 or 600 ( not mater) if the score is
the same

Thanks,
Yaniv


Yaniv C. Posted on 2009-11-22 09:06:37.0Z
Sender: 1051.4b08f847.1804289383@sybase.com
From: Yaniv C.
Newsgroups: sybase.public.ase.general
Subject: Re: Resolved- please ignore
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4b08ff1d.1156.1681692777@sybase.com>
References: <4b08f8f0.1069.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 22 Nov 2009 01:06:37 -0800
X-Trace: forums-1-dub 1258880797 10.22.241.41 (22 Nov 2009 01:06:37 -0800)
X-Original-Trace: 22 Nov 2009 01:06:37 -0800, 10.22.241.41
Lines: 41
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28672
Article PK: 77914


> Hi
> I am trying to write the query for that and cannot.
> (ASE 15)
> Any ideas?
> Here is the problem:
>
> Demand:
> retrieve a single! student id
> from each class that got the highest score
>
> For example:
> class_id student_id score
> 1 100 10
> 1 200 20
> 2 300 40
> 2 400 30
> 3 500 50
> 3 600 50
>
> Desire result:
> 200
> 300
> 500
> Or
> 200
> 300
> 600
>
> Wrong result:
> 200
> 300
> 500
> 600
>
> Although 500 and 600 got the same score (50), just one
> sudent can be from single class
> it can be student 500 or 600 ( not mater) if the score is
> the same
>
> Thanks,
> Yaniv