Re: Crosstab question

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Leendert Paul Diterwich <paul(at)winaskon(dot)nl>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Crosstab question
Date: 2006-10-22 15:45:56
Message-ID: 20061022154556.GA29357@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sun, Oct 22, 2006 at 01:57:09PM +0200, Leendert Paul Diterwich wrote:
> The problem is that the data is being shifted when there is no
> price for Supplier1 for product 3:
>
> Productnumber Supplier1 Supplier2
> 2 0.8 0.9
> 3 1.1(WRONG!)
>
> I'm using this command to retrieve the data:
>
> select * from crosstab('select int_artnr, int_crednr, flt_inkoopprijs from
> artcredinkoopprijzen where
> int_crednr = 2 OR int_crednr = 3') as c(int_artnr integer, supp1 float4,
> supp2 float4);

Try using the crosstab(text source_sql, text category_sql) variant.

Unrelated suggestion: prices should probably be numeric instead of
floating-point due to the inexactness of the latter.

--
Michael Fuhr

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Luca Ferrari 2006-10-23 08:49:16 delete on cascade
Previous Message Leendert Paul Diterwich 2006-10-22 11:57:09 Crosstab question