agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Andreas Joseph Krogh <andreak@officenet.no>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Update ordered
Date: Mon, 27 Jan 2014 15:36:10 +0100 (CET)
Message-ID: <OfficeNetEmail.16.5201e94b04d2ffbf.143d41efaac@prod2> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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

view thread (7+ messages)  latest in thread

Message-ID: <OfficeNetEmail.16.5201e94b04d2ffbf.143d41efaac@prod2>
Permalink:  ../OfficeNetEmail.16.5201e94b04d2ffbf.143d41efaac@prod2/
Also on:    postgresql.org/message-id/OfficeNetEmail.16.5201e94b04d2ffbf.143d41efaac@prod2

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: andreak@officenet.no
  Subject: Re: Update ordered
  In-Reply-To: <OfficeNetEmail.16.5201e94b04d2ffbf.143d41efaac@prod2>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox