Re: help in writing query - Mailing list pgsql-sql

From Scott Marlowe
Subject Re: help in writing query
Date
Msg-id dcc563d10806101216p6e43e9f8qe0278ade9ff2a558@mail.gmail.com
Whole thread Raw
In response to Re: help in writing query  ("maria s" <psmg01@gmail.com>)
Responses Re: help in writing query  ("maria s" <psmg01@gmail.com>)
List pgsql-sql
On Tue, Jun 10, 2008 at 11:51 AM, maria s <psmg01@gmail.com> wrote:
> Hi Rosario,
> Thanks for the link. I hope this will solve my problem.

It should be able to.  Note that crosstab functions expect "square"
inputs from the select they run.  I.e. you can't have empty columns,
you need to replace NULL output with something like a space or empty
string.

This is bad input for crosstab:

col1 col2 col3
1 2 3
2 3 NULL
3 NULL 6

But this will work:

col1 col2 col3
1 2 3
2 3 '' <- an empty string
3 '' 6

The crosstab functions are wonderfully useful btw, once you figure all
the little quirks like this out.


pgsql-sql by date:

Previous
From: Steve Midgley
Date:
Subject: Re: Conceptual Design Question
Next
From: "maria s"
Date:
Subject: Re: help in writing query