Re: table returning function for each row in other resultset

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Niels Jespersen <NJN(at)dst(dot)dk>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: table returning function for each row in other resultset
Date: 2021-02-03 15:07:38
Message-ID: CAKFQuwbh2sDFtfSupMz-f-3CFDCHaF1MzbaSCkJcNmAsAMG5Ug@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Feb 3, 2021 at 8:01 AM Niels Jespersen <NJN(at)dst(dot)dk> wrote:

> 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);
> [...]
> How can I accomplish this, please.
>

Lateral Join.

(not tested)
SELECT *
FROM resultset, func(id, date_begin, date_end, amount);

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marco Lechner 2021-02-03 16:45:40 Tool for migrating Gupta SQLBase to PostgreSQL
Previous Message Niels Jespersen 2021-02-03 15:01:07 table returning function for each row in other resultset