Search Postgresql Archives

Re: row numbering

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux