pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: ªL©[¾N <s9154083@cyut.edu.tw>
To: pgsql-sql@postgresql.org
Subject: A SQL Question About distinct, limit, group by, having, aggregate
Date: Thu, 31 Mar 2005 10:29:16 +0800
Message-ID: <20050331022422.M58459@cyut.edu.tw> (raw)

i have a little question, how to get 3 higher score student in every class.
Data looks like as below

problem:
id		class		score
john		a		100
jenny		a		70
ken		a		59
mary		b		85
jacky		b		80
lily		b		70
kevin		b		50
david		b		30
tina		c		85
tony		c		80
bare		c		70
vivian		c		60
eric		c		57
andy		c		50

result:
id		class		score
john		a		100
jenny		a		70
ken		a		59
mary		b		85
jacky		b		80
lily		b		70
tina		c		85
tony		c		80
bare		c		70

--
http://alumni.cyut.edu.tw
Open WebMail Project (http://openwebmail.org)




view thread (5+ messages)  latest in thread

Message-ID: <20050331022422.M58459@cyut.edu.tw>
Permalink:  ../20050331022422.M58459@cyut.edu.tw/
Also on:    postgresql.org/message-id/20050331022422.M58459@cyut.edu.tw

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: s9154083@cyut.edu.tw
  Subject: Re: A SQL Question About distinct, limit, group by, having, aggregate
  In-Reply-To: <20050331022422.M58459@cyut.edu.tw>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox