Postgresql – Returning dynamic query results from PL/PGSQL function, multiple rows
I work on the following test table: select * from test; id | broker | affiliate | leads ----+---------+-----------+------- 1 | broker1 | aff1 | 1 2 | broker1 | aff2 | 2 3 | broker2 | aff2 | 4…