Re: Need query

From: Imre Samu <pella(dot)samu(at)gmail(dot)com>
To: Firthouse banu <penguinsfairy(at)gmail(dot)com>
Cc: "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Need query
Date: 2021-07-17 08:20:50
Message-ID: CAJnEWwkp6BWxFdByPjF41zuuPxWGPy5qNkJr2bOLr9V6OVv=Cw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

> Can anyone write query to get this desired output from table one in
Postgres please.

some links ; maybe useful :
https://stackoverflow.com/questions/3002499/postgresql-crosstab-query
https://dba.stackexchange.com/questions/38758/postgres-use-result-of-group-by-as-column-names
https://stackoverflow.com/questions/15506199/dynamic-alternative-to-pivot-with-case-and-group-by

keywords: crosstab, tablefunc,

Best,
Imre

Firthouse banu <penguinsfairy(at)gmail(dot)com> ezt írta (időpont: 2021. júl. 17.,
Szo, 9:25):

> Table1
> Name Fruit
> A Mango
> A Apple
> A Grape
> B. Mango
> B. Mango
> A. Mango
> A. Apple
>
> Output
> Name. Mango Apple Grape
> A. 2. 2. 1
> B. 2. 0. 0
>
> Can anyone write query to get this desired output from table one in
> Postgres please.
>
> TIA
>

In response to

  • Need query at 2021-07-17 07:24:57 from Firthouse banu

Browse pgsql-admin by date

  From Date Subject
Next Message Thomas Kellerer 2021-07-17 08:32:45 Re: Need query
Previous Message David G. Johnston 2021-07-17 07:53:38 Re: Need query