Update Current Row Based on Prior Row

Поиск
Список
Период
Сортировка
От Philip Brooks
Тема Update Current Row Based on Prior Row
Дата
Msg-id 1338655423.91460.YahooMailNeo@web121403.mail.ne1.yahoo.com
обсуждение исходный текст
Ответы Re: Update Current Row Based on Prior Row  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Update Current Row Based on Prior Row  (Andreas Kretschmer <akretschmer@spamfence.net>)
Список pgsql-novice
I had what I thought was a simple update query.. and it has stumped me.
I have a table ordered by a SERIAL named ROWID.
In that table I have a column named TITLE.
Where TITLE is null, I want to set it equal to the previous row's TITLE.

In SQLite, I did it with this:

UPDATE bf
SET title = (
  SELECT title
  FROM bf AS prev
  WHERE title IS NOT NULL AND prev.rowid < bf.rowid
  ORDER BY prev.rowid DESC
  LIMIT 1
)
WHERE title IS NULL

The update is not porting to Postgresql.

Ideas?

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: database in different location owned by different user
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Update Current Row Based on Prior Row