Thank you. It really worked.
From: David Johnston
Sent: Wednesday, June 06, 2012 3:17 PM
To: 'Efraín Déctor' ; pgsql-general@postgresql.org
Subject: RE: [GENERAL] Renumber table rows
Try something along the lines of:
UPDATE operador SET idoperador = new_idoper
@postgresql.org
Subject: [GENERAL] Renumber table rows
Hello.
I have a table that his primary key is not ordered is something like this:
1 - a
12- b
123 - c
etc.
I want to do an update to make it like this
1 – a
2 – b
3 – c
I tried this:
UPDATE operador SET
Hello.
I have a table that his primary key is not ordered is something like this:
1 - a
12- b
123 - c
etc.
I want to do an update to make it like this
1 – a
2 – b
3 – c
I tried this:
UPDATE operador SET idoperador=(SELECT row_number() OVER (ORDER BY idoperador)
from operador)
But