Re: obtain the difference between successive rows

Поиск
Список
Период
Сортировка
От Raymond O'Donnell
Тема Re: obtain the difference between successive rows
Дата
Msg-id 508284B9.9020501@iol.ie
обсуждение исходный текст
Ответ на obtain the difference between successive rows  (ochaussavoine <olivier.chaussavoine@gmail.com>)
Ответы Re: obtain the difference between successive rows  (Thalis Kalfigkopoulos <tkalfigo@gmail.com>)
Список pgsql-general
On 20/10/2012 11:54, ochaussavoine wrote:
> Hi,
> I have a table 'tmvt' with a field 'created' in the row, and would like to
> compute the difference between successive rows. The solution I found is:
>
> It is complicate and very long to perform. The problem could be simply
> solved with MySql by creating a new field and updating it using a statement
> with @.
> I beleive this is a common problem for users. Do you know a simpler solution
> with postgreSql?

I think you can do it with a window function.

http://www.postgresql.org/docs/9.2/static/tutorial-window.html
http://www.postgresql.org/docs/9.2/static/functions-window.html

Ray.


--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie


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

Предыдущее
От: ochaussavoine
Дата:
Сообщение: obtain the difference between successive rows
Следующее
От: Thalis Kalfigkopoulos
Дата:
Сообщение: Re: obtain the difference between successive rows