Re: How to write an query to get this result?

From: Richard Huxton <dev(at)archonet(dot)com>
To: "Daniel Dunajsky" <daniel(at)dunajsky(dot)com>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: How to write an query to get this result?
Date: 2003-05-02 08:48:35
Message-ID: 200305020948.36607.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thursday 01 May 2003 4:07 am, Daniel Dunajsky wrote:
> Hello,
>
> Is there any way how to retrieve result normally displayed as:
>
> TOTAL 268
> Administrator 7
> Internet Only 178
> Filtered Internet 7
>
> To be like this:
>
> TOTAL Administrator Internet Only Filtered Internet
> 268 7 178 7
>
> That means, the rows of the first column of the first case are headers in
> the second case. Similarly, the rows of the second column are displayed as
> one row.

There are some crosstab-style functions in the contrib directory in source.
Can't remember where, sorry. Look for something like "cross-tab" or try the
table-function examples.

--
Richard Huxton

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas Schmitz 2003-05-02 12:08:07 Re: Problem with old relation
Previous Message Yudha [ Inas_Husband ] Setiawan 2003-05-02 08:22:47 It's About field type array