table returning function for each row in other resultset

Поиск
Список
Период
Сортировка
Искать
От
Niels Jespersen
Тема
table returning function for each row in other resultset
Дата
Msg-id
e87c1245eeaa4c4e872148e6762292c9@dst.dk
Список
Дерево обсуждения
table returning function for each row in other resultset Niels Jespersen <NJN@dst.dk>
Re: table returning function for each row in other resultset "David G. Johnston" <david.g.johnston@gmail.com>
SV: table returning function for each row in other resultset Niels Jespersen <NJN@dst.dk>
Hello all

I have som data in a resultset. E.g: 

id date_begin date_end      amount
1  2021-01-04 2021-02-06  100
2  2021-03-17 2021-05-11  234

I have a table returning function that can take one row and split it into constituent monthpieces and distribute amount proportionally. 

select * from func(1, 2021-01-04, 2021-02-06, 100); 

returns 

1,2021-01-04,2021-01-31,84.848485
1,2021-02-01,2021-02-06,18.181818

So far, so good. 

Now, what I want is to run the function on the resultset from above and get 

1,2021-01-04,2021-01-31,84.848485
1,2021-02-01,2021-02-06,18.181818
2,2021-03-17,2021-03-31,63.818182
2,2021-04-01,2021-04-30,127.636364
2,2021-05-01,2021-05-11,46.8

How can I accomplish this, please. 

Regards Niels Jespersen




В списке pgsql-general по дате отправления
От: Ulrich Goebel
Дата:
Сообщение: Re: UPDATE Syntax - solved
От: David G. Johnston
Дата:
FAQ