Re: Windowing ?
| От | Andreas Kretschmer |
|---|---|
| Тема | Re: Windowing ? |
| Дата | |
| Msg-id | f02993c7-c740-e99b-e0e2-010a36ded92d@a-kretschmer.de обсуждение исходный текст |
| Ответ на | Windowing ? (Olivier Leprêtre <o.lepretre@gmail.com>) |
| Ответы |
Re: Windowing ?
|
| Список | pgsql-sql |
Am 11.12.2017 um 18:09 schrieb Olivier Leprêtre: > > Hi, > > I have a table describing sort of ordered road segments and their > associated weight. I would like to calculate weight deltas between two > consecutive segments. Problem is to substract previous from current > row and reuses result as input for the next row. > You can use the lag() - function. select ..., lag(weight) over (partition by road order by segment) ... Regards, Andreas -- 2ndQuadrant - The PostgreSQL Support Company. www.2ndQuadrant.com
В списке pgsql-sql по дате отправления: