Update ordered - Mailing list pgsql-sql

From Andreas Joseph Krogh
Subject Update ordered
Date
Msg-id OfficeNetEmail.16.5201e94b04d2ffbf.143d41efaac@prod2
Whole thread Raw
Responses Re: Update ordered
Re: Update ordered
List pgsql-sql
Hi all.
 
I want an UPDATE query to update my project's project_number in chronological order (according to the project's "created"-column) and tried this:
 
with upd as(
    select id from project order by created asc
) update project p set project_number = get_next_project_number() from upd where upd.id = p.id;
 
However, the olders project doesn't get the smalles project_number.
 
Any idea how to achive this?
 
Thanks.
 
--
Andreas Joseph Krogh <andreak@officenet.no>      mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc

pgsql-sql by date:

Previous
From: Glyn Astill
Date:
Subject: Re: Trigger function - variable for schema name
Next
From: Adrian Klaver
Date:
Subject: Re: Update ordered