Re: [SQL] enumerating rows

2001-04-12 Thread Peter Eisentraut
Kovacs Zoltan writes: > Maybe a trivial question, maybe it's foreign from SQL, I'dont know... > How to add a column which stands for the row number in each row of the > result? E.g.: > > row_no | column1 | column2 | ... > ---+-+-+ ... > 1 | datum11 | datum12 | ... >

Re: [SQL] enumerating rows

2001-04-11 Thread Oliver Elphick
Kovacs Zoltan wrote: >> Here is a method which is fairly cumbersome, but will do what you want. >> (Whether what you want is useful, is another matter. The row numbers >> have no meaning except to delineate which row is printed after which; they >> bear no relation to their order in the t

Re: [SQL] enumerating rows

2001-04-11 Thread Josh Berkus
Kovacs, Oliver, First, thank you Oliver for the nice C program for this purpose. If there doesn't turn out to be another method, it shoudl og in the postgresql.org site. However, Postgresql does have an internal row count for query results. Otherwise LIMIT and OFFSET would not w

Re: [SQL] enumerating rows

2001-04-11 Thread Kovacs Zoltan
> Here is a method which is fairly cumbersome, but will do what you want. > (Whether what you want is useful, is another matter. The row numbers > have no meaning except to delineate which row is printed after which; they > bear no relation to their order in the table.) Thanks, Oliver! Are you su

Re: [SQL] enumerating rows

2001-04-11 Thread Oliver Elphick
Kovacs Zoltan wrote: >> Use the "serial" column type. >Unfortunately it's not what I expect. Assume that I have an arbitrary >"SELECT expr1 as column1, expr2 as column2, ..." which gives > >column1 | column2 | ... >+-+- ... >..data.. >.

RE: [SQL] enumerating rows

2001-04-11 Thread Koen Antonissen
I was searching for the same thing, I couldn't found it though :( -Original Message- From: Kovacs Zoltan [mailto:[EMAIL PROTECTED]] Sent: woensdag 11 april 2001 16:37 To: Poul L. Christiansen Cc: [EMAIL PROTECTED] Subject: Re: [SQL] enumerating rows > Use the "serial

Re: [SQL] enumerating rows

2001-04-11 Thread Kovacs Zoltan
> Use the "serial" column type. Unfortunately it's not what I expect. Assume that I have an arbitrary "SELECT expr1 as column1, expr2 as column2, ..." which gives column1 | column2 | ... +-+- ... ..data.. I would like to get the same res

Re: [SQL] enumerating rows

2001-04-11 Thread Poul L. Christiansen
Use the "serial" column type. create table myTable (row_no serial,column1 varchar(10),column2 varchar(20)); HTH, Poul L. Christiansen On Wed, 11 Apr 2001, Kovacs Zoltan wrote: > Maybe a trivial question, maybe it's foreign from SQL, I'dont know... > How to add a column which stands for the row