Skip site navigation (1) Skip section navigation (2)

Re: row numbering

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: row numbering
Date: 2005-02-28 16:46:43
Message-ID: 20050228174643.E583@hermes.hilbert.loc (view raw or flat)
Thread:
Lists: pgsql-general
> > > > is there a way return a column with the row number automatically
> > > > generated according the way the rows were processed by the query.
> > >
> > > No, but you can easily keep a counter in the client.
> >
> > How, then, do I do it if I "need" the "row number" in a view ?
> 
> Keep the counter in the client as you process or display the result 
> rows.
Well, but I'd like to use those "row numbers" in a comparison
right inside the view definition ...

Eg.:

There are 5 vaccinations in a given vaccination schedule.

Patient had 3 shots.

I want the view to show me that shot 4 and 5 are missing
without having to enter the cardinality of the vaccination in
the original data.

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

In response to

Responses

pgsql-general by date

Next:From: Jeff DavisDate: 2005-02-28 16:48:14
Subject: Re: Possible to run the server with ANSI/ISO string
Previous:From: Ken JohansonDate: 2005-02-28 16:40:55
Subject: Re: Possible to run the server with ANSI/ISO string escapeing

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group