pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas Wagner <thewand@web.de>
To: M Sarwar <sarwarmd02@outlook.com>
To: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Subject: Re: From CROSSTAB: One Column data with Two results columns
Date: Mon, 15 Apr 2024 19:41:47 +0200
Message-ID: <c1724e227b02088dddacb6db20e9e7b083267786.camel@web.de> (raw)
In-Reply-To: <DM4PR19MB5978C5982BF97D6DE105158AD3092@DM4PR19MB5978.namprd19.prod.outlook.com>
References: <PH2P110MB0922542FEBDBD433903505A9FF0AA@PH2P110MB0922.NAMP110.PROD.OUTLOOK.COM>
	<DM4PR19MB59785E2044FF7F30410FDAABD30A2@DM4PR19MB5978.namprd19.prod.outlook.com>
	<DM4PR19MB5978E1148EDA0DB8AA8DED7ED30A2@DM4PR19MB5978.namprd19.prod.outlook.com>
	<DM4PR19MB59788EAD138EA457D4FE6A9BD30A2@DM4PR19MB5978.namprd19.prod.outlook.com>
	<eabe02b475c34361babc34d986aef1f76bbfa7ba.camel@web.de>
	<DM4PR19MB5978C5982BF97D6DE105158AD3092@DM4PR19MB5978.namprd19.prod.outlook.com>

Hello Mr. Sarwar!

I'm not certain about first and last names in foreign countries, so my
apologies if it's your first name.

Am Montag, dem 15.04.2024 um 12:25 +0000 schrieb M Sarwar:
> 
> Hello Andreas,
> Using a function, I am generating  CROSSTAB SQL and the number of
> columns will vary for each execution. With that, it is extremely
> difficult to use view on this task.


I'm still not sure whether I understand your question. You look for a
way to produce statements like

SELECT test1p1.data, test1p2.data, test1p3.data,
	f(test1p1.data), f(test1p2.data), f(test1p3.data)
FROM test1p1, test1p2, test1p3;

programmatically? ("f()" is a user-defined function deriving the left
values on the sample-picture to the right values.)

In case using multiple tables is new to you, have a look at the "JOIN"-
statement.

Regards,
Andreas Wagner





view thread (7+ messages)  latest in thread

Message-ID: <c1724e227b02088dddacb6db20e9e7b083267786.camel@web.de>
Permalink:  ../c1724e227b02088dddacb6db20e9e7b083267786.camel@web.de/
Also on:    postgresql.org/message-id/c1724e227b02088dddacb6db20e9e7b083267786.camel@web.de

 · 

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: pgsql-admin@postgresql.org
  Cc: thewand@web.de, sarwarmd02@outlook.com, pgsql-admin@lists.postgresql.org
  Subject: Re: From CROSSTAB: One Column data with Two results columns
  In-Reply-To: <c1724e227b02088dddacb6db20e9e7b083267786.camel@web.de>

* 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