Re: pivot functions with variable number of columns

From: Chris Travers <chris(dot)travers(at)gmail(dot)com>
To: punnoose <punnoose(dot)pj(at)dwisesolutions(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: pivot functions with variable number of columns
Date: 2012-09-06 07:40:25
Message-ID: CAKt_Zft5CsGQvr05p-LkEOTAraJYO5fuvT=Q=G87TTrKou2YZA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Sep 5, 2012 at 10:14 PM, punnoose <punnoose(dot)pj(at)dwisesolutions(dot)com>wrote:

> I want to have a pivot like function in which i should have variable number
> of columns.i went for crosstab but it doesnot support variable number of
> columns.Can any body suggest an alternative.like if i have a event at a
> particular time of the day like one at 02:35,11:34, then i should have
> column name 02:35,11:34.
>
> You could detect the columns you want to return and use a plpgsql function
that returns a refcursor, I suppose.

Best Wishes,
Chris travers

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2012-09-06 08:12:49 Re: Moving several databases into one database with several schemas
Previous Message Raghavendra 2012-09-06 07:27:38 Re: pivot functions with variable number of columns