Re: [SQL] A SQL Question About distinct, limit, group by, having, aggregate

2005-03-31 Thread Lin Kun Hsin
Actually, i have a method to solve this problem. But i really want to know, we have to write more statement to do one thing? First step, we have to create 2 sequence. Let call them "foo" and "foo1". create sequence foo; create sequence foo1; then, you can run below statement, and you will see t

Re: [SQL] A SQL Question About distinct, limit, group by, having,

2005-03-31 Thread Ragnar Hafstað
On Thu, 2005-03-31 at 13:14 +0800, Lin Kun Hsin wrote: > below is the sql schema. i hope it will help. > > i want the top 3 score students in every class this has been discussed before. a quick google gives me: http://archives.postgresql.org/pgsql-sql/2004-04/msg00067.php gnari

Re: [SQL] A SQL Question About distinct, limit, group by, having, aggregate

2005-03-30 Thread Lin Kun Hsin
below is the sql schema. i hope it will help. i want the top 3 score students in every class below is the original sql solution, but when we have 100 class , we have to union 100 times? have any better performance statement? select * from ( (select * from allscore where class = 'a' order by sc

Re: [SQL] A SQL Question About distinct, limit, group by, having, aggregate

2005-03-30 Thread Jaime Casanova
On Thu, 31 Mar 2005 10:29:16 +0800, "æï[é" <[EMAIL PROTECTED]> wrote: > i have a little question, how to get 3 higher score student in every class. > Data looks like as below > > problem: > idclass score > john a 100 > jenny a 70 >

[SQL] A SQL Question About distinct, limit, group by, having, aggregate

2005-03-30 Thread 林[鋅
i have a little question, how to get 3 higher score student in every class. Data looks like as below problem: id class score johna 100 jenny a 70 ken a 59 maryb 85 jacky