public inbox for [email protected]
help / color / mirror / Atom feedFrom: Anthony Apollis <[email protected]>
To: Geoff Winkless <[email protected]>
Cc: [email protected]
Subject: Re: TSQL To Postgres - Unpivot/Union All
Date: Thu, 20 Jul 2023 17:47:08 +0200
Message-ID: <CAJyMCY+97Lg=EANU6g5iioj0ay+FMssws2Dfjb1vV9UGUjG39w@mail.gmail.com> (raw)
In-Reply-To: <CAEzk6fcfXk_-UweJZ_hFWecDAs_0ECd27Q_r_=o1V78k5xBBuA@mail.gmail.com>
References: <CAJyMCYJ+JGpHtpV36UP+kUAW4LoprmgbgDPLCpe_8A0xbe=GZA@mail.gmail.com>
<CAJyMCYLL-mMuCfXT8M1kD-=6=r8YHHrSGbT-rN25vCwtVyr1jg@mail.gmail.com>
<CAEzk6ffszUabGjDhBOCZqTP0PoMzLaJtnu+=ye2snMVSOy=b4w@mail.gmail.com>
<CAJyMCYLvymAS+7DoiHGs2zHKGigQj7waGzdXWbo+3xBUzi4Mew@mail.gmail.com>
<CAJyMCYJDiY6hoLdtM=T2nc8rnZTxBbNOr0mHsJ5v6OPtes6B0Q@mail.gmail.com>
<CAEzk6fcfXk_-UweJZ_hFWecDAs_0ECd27Q_r_=o1V78k5xBBuA@mail.gmail.com>
CREATE TEMP TABLE temp_FieldFlowsFact (
Account varchar(20),
"Calendar day" DATE,
"Financial year" varchar(5),
Period varchar(8),
"Period type" varchar(10),
Metric varchar(50),
"Metric Value" float
)
It was created as a temp table in SQLServer, but it does not have to be in
Postgres. Thanks
On Thu, 20 Jul 2023 at 16:51, Geoff Winkless <[email protected]> wrote:
> On Thu, 20 Jul 2023 at 15:28, Anthony Apollis <[email protected]>
> wrote:
> > I am attaching my TSQL and Postgres SQL:
>
> You're still missing some CREATEs, for example for temp_FieldFlowsFact.
>
> Even assuming your columns list is correct, I would still (and as a
> matter of habit) include the target column list in your INSERT
> statements, if only to make your own life easier, but especially
> because any later changes to the tables could end up shifting the
> position of the columns.
>
> Certainly it will be easier for anyone else trying to disentangle the SQL
> later.
>
> As an aside, can you clarify whether you mean temporal tables (and are
> you using a temporal tables extension)? Or should that read
> "temporary"?
>
> Geoff
>
view thread (8+ messages)
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: TSQL To Postgres - Unpivot/Union All
In-Reply-To: <CAJyMCY+97Lg=EANU6g5iioj0ay+FMssws2Dfjb1vV9UGUjG39w@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox