Re: Update ordered

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Update ordered
Дата
Msg-id 52E6738C.7010101@gmail.com
обсуждение исходный текст
Ответ на Update ordered  (Andreas Joseph Krogh <andreak@officenet.no>)
Ответы Re: Update ordered  (Andreas Joseph Krogh <andreak@officenet.no>)
Список pgsql-sql
On 01/27/2014 06:36 AM, Andreas Joseph Krogh wrote:
> 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?

That would seem to depend on what get_next_project_number() does, the 
contents of which are unknown.

> 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


-- 
Adrian Klaver
adrian.klaver@gmail.com



В списке pgsql-sql по дате отправления:

Предыдущее
От: Andreas Joseph Krogh
Дата:
Сообщение: Update ordered
Следующее
От: Andreas Joseph Krogh
Дата:
Сообщение: Re: Update ordered