Thanks to Scott and Taras for pointing me to the crosstab functions. I only had a quick look but they seem very helpful! Kind regards, Felix
pgsql-general by date:
Соглашаюсь с условиями обработки персональных данных