Sv: Re: Difficulties with LAG-function when calculating overtime

Поиск
Список
Период
Сортировка
От Andreas Joseph Krogh
Тема Sv: Re: Difficulties with LAG-function when calculating overtime
Дата
Msg-id VisenaEmail.4c.51bde41e996a86d1.1672cc0ac94@tc7-visena
обсуждение исходный текст
Ответ на Re: Difficulties with LAG-function when calculating overtime  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Sv: Sv: Re: Difficulties with LAG-function when calculatingovertime  (Andreas Joseph Krogh <andreas@visena.com>)
Список pgsql-sql
På mandag 19. november 2018 kl. 17:08:57, skrev David G. Johnston <david.g.johnston@gmail.com>:
On Mon, Nov 19, 2018 at 6:24 AM Andreas Joseph Krogh <andreas@visena.com> wrote:
Anyone has a clever way to solve this kinds of issues and craft a query which produces the desired result as in the table above?
 
Thinking in terms of theory - you need to calculate the first row and then calculate the next row using data from the first row.  Then calculate the third row using data from the second row (you might need to carry-forward some value from the first row so that the third row can see them...).  That sounds like the algorithm for iteration which is implemented in SQL via "WITH RECURSIVE".
 
David J.
 
Yea, I kind of figured RECURSIVE CTE was the way foreward...
If anyone has got this working, give me a tip:-)
 
--
Andreas Joseph Krogh

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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Difficulties with LAG-function when calculating overtime
Следующее
От: Andreas Joseph Krogh
Дата:
Сообщение: Sv: Sv: Re: Difficulties with LAG-function when calculatingovertime