obtaining row number of select

From: kkeller(at)speakeasy(dot)net (Keith Keller)
To: pgsql-sql(at)postgresql(dot)org
Subject: obtaining row number of select
Date: 2002-02-12 02:23:43
Message-ID: fbu94a.31f.ln@wombat.san-francisco.ca.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

So I'm trying to generate a pseudo-serial number of a select
statement on the fly, and I want to do so within the select
statement. I could do this programmatically, but I wish to
use the select statement so that I can use it in creating a
view.

So, I would like to do something like so:

select serial(),* from mytable order by 1;

But of course that won't work. :) Is there any way to
autovivify a serial-like column for a select statement?
(I've scoured the docs, and still can't find an answer.)

--keith

--
kkeller(at)speakeasy(dot)net
public key: http://wombat.san-francisco.ca.us/kkeller/public_key
alt.os.linux.slackware FAQ: http://wombat.san-francisco.ca.us/perl/fom

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Unnikrishnan Menon 2002-02-12 04:09:21 Re: Oracle "Jobs" in PostgreSQL
Previous Message RPI 2002-02-12 01:33:14 help importing external excel file