Re: How to create crosstab with 3 values in every crosstab column - Mailing list pgsql-general

From Andrus
Subject Re: How to create crosstab with 3 values in every crosstab column
Date
Msg-id 7892A37BDB5F4C7A9E09D3E4AB23DC5F@dell2
Whole thread Raw
In response to Re: How to create crosstab with 3 values in every crosstab column  (Misa Simic <misa.simic@gmail.com>)
Responses Re: How to create crosstab with 3 values in every crosstab column  (Misa Simic <misa.simic@gmail.com>)
List pgsql-general
Thank you.

>first calculate how much columns we should return...No of stores in in your
>Sales table (multiply 3 in your case)...
>(and based on that - build the grid in UI)
>then with knowing that - we select full "table"  with simple 3 functions:
>CalcSales(coount, Store), getBudget(account, Store)
>and then build dynamic query with those 3 functions many times as we have
>stores as columns...

My goal is to open result En excel.
Instead of building dynamic query isn't it reasonable to create csv file
directly from code without using crosstab
but creating it manually ?
It looks that crosstab does not have any advantages instead on manual
crosstab creation ?

Another possibility is to merge those 3 columns into single column and
crosstab it .
After that create csv file by splitting single column into 3 columns.

Can some postgres array function or something like used to split 1 column
into 3 columns in result without
building query string manually ?

I posted this also in

http://stackoverflow.com/questions/9162497/how-to-generate-crosstab-with-3-columns-for-every-store-in-postgresql

Andrus.


pgsql-general by date:

Previous
From: "Ralph Dell"
Date:
Subject: windows 2008 scheduled task problem
Next
From: Susan Cassidy
Date:
Subject: Re: windows 2008 scheduled task problem