> Is there a function or special system label I can use that would
generate a sequence number in the returning result set?
Would something like this work for you?
CREATE TEMP SEQUENCE foo;
SELECT a, b, c, nextval('foo') AS order FROM t1 ORDER BY a;
Mike Relyea
Product Development Engineer
Xe
"Campbell, Lance" <[EMAIL PROTECTED]> writes:
> Is there a function or special system label I can use that would
> generate a sequence number in the returning result set?
The usual hack is a temporary sequence:
regression=# create temp sequence s1;
CREATE SEQUENCE
regression=# select nextval('s1'
: Thursday, October 09, 2008 5:48 PM
Subject: Re: [SQL] sequence number in a result
Howdy, Lance.
I had that problem about a year ago, and AFAIK there is no solution, at least
not in SQL Standard.
What I did was something like
SELECT a,b,c,count(y.a) as order
FROM t1 x , t1 y
WH
Howdy, Lance.
I had that problem about a year ago, and AFAIK there is no solution, at least
not in SQL Standard.
What I did was something like
SELECT a,b,c,count(y.a) as order
FROM t1 x , t1 y
WHERE ((x.a > y.a)
OR (x.a = y.a
AND x.ID <= y.ID)) -- Use here whatever you have as primary key