Re: query or design question - Mailing list pgsql-sql

From Richard Huxton
Subject Re: query or design question
Date
Msg-id 200310201812.49869.dev@archonet.com
Whole thread Raw
In response to query or design question  (Adam Witney <awitney@sghms.ac.uk>)
List pgsql-sql
On Monday 20 October 2003 11:58, Adam Witney wrote:
> Hi,
>
> I have a table like so
>
> CREATE TABLE imagene (
> id             int
> bioassay_id    int
> gene_id        text
> s_row          int
> s_column       int
> s_meta_row     int
> s_meta_column  int
> sig_median     numeric
> bkg_median     numeric
> );

> And I need to generate an output like this......
>
>              bioassay_id=106        bioassay_id=107
>          ----------------------  ----------------------
> gene_id, sig_median, bkg_median, sig_median, bkg_median


> I am not sure if a crosstab function will do this?

There are some examples in contrib/tablefunc that might well be useful for 
you. You should also check out the "Set Returning Functions" article on 
http://techdocs.postgresql.org/

If you find your requirements getting particularly complex, I'd be tempted to 
do the hard work in the application.

--  Richard Huxton Archonet Ltd


pgsql-sql by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Which is faster SQL or PL/PGSQL
Next
From: Tom Lane
Date:
Subject: Re: Unable to user pg_restore