From: | Jaime Casanova <systemguards(at)gmail(dot)com> |
---|---|
To: | 林�[鋅 <s9154083(at)cyut(dot)edu(dot)tw> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: A SQL Question About distinct, limit, group by, having, aggregate |
Date: | 2005-03-31 03:01:24 |
Message-ID: | c2d9e70e05033019015c554f03@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Thu, 31 Mar 2005 10:29:16 +0800, "林�[鋅" <s9154083(at)cyut(dot)edu(dot)tw> wrote:
> 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
>
Actually, i don't see any difference between problem and results but maybe
select * from yourTable order by class, score desc
regards,
Jaime Casanova
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Fuhr | 2005-03-31 03:11:54 | Re: Postgres 7.3 migrate to 8.0 date problems. |
Previous Message | =?BIG5?Q?=AAL=A9?=[=?BIG5?Q?=BEN?= | 2005-03-31 02:29:16 | A SQL Question About distinct, limit, group by, having, aggregate |