Re: Column as arrays.. more efficient than columns? - Mailing list pgsql-general

From Ow Mun Heng
Subject Re: Column as arrays.. more efficient than columns?
Date
Msg-id 1189136489.17218.44.camel@neuromancer.home.net
Whole thread Raw
In response to Re: Column as arrays.. more efficient than columns?  (Joe Conway <mail@joeconway.com>)
Responses Re: Column as arrays.. more efficient than columns?
List pgsql-general
On Thu, 2007-09-06 at 20:19 -0700, Joe Conway wrote:
> Ow Mun Heng wrote:

> > => select code, round(avg(case when subset = '0' then value else null
> > end),0) as v0,
> > round(avg(case when subset = '1' then value else null end),0) as v1,
> > round(avg(case when subset = '2' then value else null end),0) as v2,
> > round(avg(case when subset = '3' then value else null end),0) as v3,
> > round(avg(case when subset = '4' then value else null end),0) as v4
> > from foo
> > group by code;
> >  code | v0 | v1 | v2 | v3 | v4
> > ------+----+----+----+----+----
> >  A    | 98 | 20 | 98 | 98 | 98
>
> An alternative way to get the output below, would be to feed your
> aggregate query above to the crosstab() function in contrib/tablefunc.


I just looked at it and seems like the

...
row_name and value must be of type text
...


pgsql-general by date:

Previous
From: Joe Conway
Date:
Subject: Re: Column as arrays.. more efficient than columns?
Next
From: "Joshua D. Drake"
Date:
Subject: Re: Call for Speakers PostgreSQL Conference Fall 2007