From: | Roland Roberts <roland(at)astrofoto(dot)org> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: How to select and result row number?? |
Date: | 2002-09-17 14:14:58 |
Message-ID: | m265x4r9ct.fsf@kuiper.rlent.pnet |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
>>>>> "Yudie" == Yudie <yudie(at)axiontech(dot)com> writes:
Yudie> what is the select statement so I can get result records like this
Yudie> no cityname
Yudie> ---- --------------
Yudie> 1 NEW YORK
Yudie> 2 LOS ANGELES
Yudie> 3 HOUSTON
Yudie> 4 ....
Yudie> 5 ...
This is not really a SQL type result; you are probably better of
writing something in a procedural language. That said, something like
this seems to work for 7.2:
create sequence temp_counter;
select nextval('temp_counter'), * from whatever;
If you have an 'order by', the above will not work. You could then
try either building a temporary table or using a subselect
select nextval('temp_counter'), * from (select .... order by ...);
roland
--
PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD RL Enterprises
roland(at)rlenter(dot)com 76-15 113th Street, Apt 3B
roland(at)astrofoto(dot)org Forest Hills, NY 11375
From | Date | Subject | |
---|---|---|---|
Next Message | Robert J. Sanford, Jr. | 2002-09-17 14:17:05 | Join Question |
Previous Message | Richard Huxton | 2002-09-17 10:07:33 | Re: Dublicates pairs in a table. |