Re: row numbering

From: josue <josue(at)lamundial(dot)hn>
To: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: row numbering
Date: 2005-03-01 18:26:36
Message-ID: 4224B3DC.8070203@lamundial.hn
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I figured it out, maybe is not the most elegant way but it work for my
case where only small sets are retrieved

create table foo2 (pk int, valor numeric(12,2), porce numeric(5,2));

insert into foo2 values (1,7893.45,0.4);
insert into foo2 values (5,7893.45,0.3);
insert into foo2 values (9,7893.45,0.3);

select *,
(select count(*) from foo2 as f2
where f2.oid <= foo2.oid) as counter
from foo2;

--
Sinceramente,
Josué Maldonado.

... "Un científico es un hombre tan endeble y humano como cualquiera;
sin embargo, la búsqueda científica puede ennoblecerle, incluso en
contra de su voluntad." -- Isaac Asimov

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim C. Nasby 2005-03-01 19:14:26 Re: Fast major-version upgrade (was: [GENERAL] postgresql 8.0 advantages)
Previous Message Tom Lane 2005-03-01 18:22:08 Re: Index size