pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Pavel Stehule <pavel.stehule@gmail.com>
To: Jyoti Seth <jyotiseth2001@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: dynamic columns in a query
Date: Thu, 11 Jun 2009 10:54:39 +0200
Message-ID: <162867790906110154t7e555899h5fbc006266f7e708@mail.gmail.com> (raw)
In-Reply-To: <000001c9ea68$217cb890$647629b0$@com>
References: <200906100519.34171.jfabiani@yolo.com>
	<000001c9ea68$217cb890$647629b0$@com>

Hello

2009/6/11 Jyoti Seth <jyotiseth2001@gmail.com>:
> Hi All,
>
> Is there any way in postgres to write a query to display the result in
> matrix form. (where column names are dynamic)
>

look on http://okbob.blogspot.com/2008/08/using-cursors-for-generating-cross.html

regards
Pavel Stehule

> For eg.
>
>
> Employee Name   Client1 Client2 Client3 Client4
> Emp1                    100             102             90              23
> Emp2                    56              0               23              98
> Emp3                    34              45              76              0
>
>
> Here Client1, Client2... are the values from the database.
>
> Thanks,
> Jyoti
>
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>


view thread (3+ messages)

Message-ID: <162867790906110154t7e555899h5fbc006266f7e708@mail.gmail.com>
Permalink:  ../162867790906110154t7e555899h5fbc006266f7e708@mail.gmail.com/
Also on:    postgresql.org/message-id/162867790906110154t7e555899h5fbc006266f7e708@mail.gmail.com

 · 

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-sql@postgresql.org
  Cc: pavel.stehule@gmail.com, jyotiseth2001@gmail.com
  Subject: Re: dynamic columns in a query
  In-Reply-To: <162867790906110154t7e555899h5fbc006266f7e708@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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox