Re: transpose time-series columnar data

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Edu Gargiulo <egargiulo(at)gmail(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: transpose time-series columnar data
Date: 2021-08-17 18:42:22
Message-ID: CAKFQuwbHNaEj4AXg_QOu_-a_8v-Pwt-Dzh6kRfTtG2PjkRjdAw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Aug 17, 2021 at 11:29 AM Edu Gargiulo <egargiulo(at)gmail(dot)com> wrote:

>
> I need to transpose and return one row for a single timestamp and one
> column for every name (fixed number of names), something like this
>
>
https://www.postgresql.org/docs/current/tablefunc.html

or

select ..., max(value) filter (where name = 'name1') as name1, max(value)
filter (where name = 'name2') as name2, etc from tbl group by ...

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2021-08-17 20:15:02 Re: Join for the parent table will not leverage the index scan
Previous Message Edu Gargiulo 2021-08-17 18:29:13 transpose time-series columnar data