Update ordered
Andreas Joseph Krogh <andreak@officenet.no>
From: Andreas Joseph Krogh <andreak@officenet.no>
To: "pgsql-sql@postgresql.org" <pgsql-sql@postgresql.org>
Date: 2014-01-27T14:36:10Z
Lists: 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