Re: Need query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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@xxxxxxxxx> 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

[Index of Archives]     [Postgresql Home]     [Postgresql General]     [Postgresql Performance]     [Postgresql PHP]     [Postgresql Jobs]     [PHP Users]     [PHP Databases]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Forum]

  Powered by Linux