I want to do a SELECT with some columns already in the database and add a ordered numeric column starting at 1 for each row (I do not want the ID). I'm using PostgreSQL 8.4.
Example:
SELECT
descricao_produto,
preco,
colunaDinamicaOrdenada AS ordem
FROM produtos;
Where colunaDinamicaOrdenada
would be a command, subselect, or something of the type that forms a sequence of ordered numbers starting at 1.
Desired result:
descricao_produto | preco | ordem
Maçã 5,90 1
Banana 4,00 2
Melancia 7,00 3
Laranja 3,00 4