Update ordered
От | Andreas Joseph Krogh |
---|---|
Тема | Update ordered |
Дата | |
Msg-id | OfficeNetEmail.16.5201e94b04d2ffbf.143d41efaac@prod2 обсуждение исходный текст |
Ответы |
Re: Update ordered
Re: Update ordered |
Список | 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;
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
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 по дате отправления: