Re: [GENERAL] query on query

2013-07-05 Thread hubert depesz lubaczewski
On Fri, Jul 05, 2013 at 08:35:22AM +0200, Luca Ferrari wrote: > On Fri, Jul 5, 2013 at 5:09 AM, Jayadevan M > wrote: > > > > > So each student may get counted many times, someone with 99 will be counted > > 10 times. Possible to do this with a fat query? The table will have many > > thousands of

Re: [GENERAL] query on query

2013-07-05 Thread Jayadevan M
> >> >> So each student may get counted many times, someone with 99 will be >> counted >> 10 times. Possible to do this with a fat query? The table will have >> many thousands of records. >> > > >Not sure I got the point, but I guess this is a good candidate for a CTE: > >WITH RECURSIVE t(n) AS ( >

Re: [GENERAL] query on query

2013-07-04 Thread Luca Ferrari
On Fri, Jul 5, 2013 at 5:09 AM, Jayadevan M wrote: > > So each student may get counted many times, someone with 99 will be counted > 10 times. Possible to do this with a fat query? The table will have many > thousands of records. > Not sure I got the point, but I guess this is a good candidate

[GENERAL] query on query

2013-07-04 Thread Jayadevan M
Hi, I have a table like this - postgres=# \d m Table "public.m" Column | Type | Modifiers +-+--- id | integer | marks | integer | postgres=# select * from m; id | marks +--- 1 |27 2 |37 3 |17 4 |27 5 |18 (5 rows) I wante