pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <shammat@gmx.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: Fwd: TSQL To Postgres - Unpivot/Union All
Date: Thu, 20 Jul 2023 17:07:31 +0200
Message-ID: <bd9eab6e-7794-9b38-3958-a08d83d15709@gmx.net> (raw)
In-Reply-To: <CAJyMCYLL-mMuCfXT8M1kD-=6=r8YHHrSGbT-rN25vCwtVyr1jg@mail.gmail.com>
References: <CAJyMCYJ+JGpHtpV36UP+kUAW4LoprmgbgDPLCpe_8A0xbe=GZA@mail.gmail.com>
	<CAJyMCYLL-mMuCfXT8M1kD-=6=r8YHHrSGbT-rN25vCwtVyr1jg@mail.gmail.com>


Anthony Apollis schrieb am 20.07.2023 um 14:17:
> Does not give me outputs for columns: Metric and Pricing Channel:
> image.png
>
> What am i doing wrong? Please assist?

UNPIVOT can be done using a LATERAL sub-query with a VALUES clause:

https://blog.sql-workbench.eu/post/unpivot-with-postgres/






view thread (8+ messages)  latest in thread

Message-ID: <bd9eab6e-7794-9b38-3958-a08d83d15709@gmx.net>
Permalink:  ../bd9eab6e-7794-9b38-3958-a08d83d15709@gmx.net/
Also on:    postgresql.org/message-id/bd9eab6e-7794-9b38-3958-a08d83d15709@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: shammat@gmx.net
  Subject: Re: Fwd: TSQL To Postgres - Unpivot/Union All
  In-Reply-To: <bd9eab6e-7794-9b38-3958-a08d83d15709@gmx.net>
  References: <CAJyMCYJ+JGpHtpV36UP+kUAW4LoprmgbgDPLCpe_8A0xbe=GZA@mail.gmail.com> <CAJyMCYLL-mMuCfXT8M1kD-=6=r8YHHrSGbT-rN25vCwtVyr1jg@mail.gmail.com> <bd9eab6e-7794-9b38-3958-a08d83d15709@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox