From: | "Andrus" <kobruleht2(at)hot(dot)ee> |
---|---|
To: | "Misa Simic" <misa(dot)simic(at)gmail(dot)com> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: How to create crosstab with 3 values in every crosstab column |
Date: | 2012-02-06 16:29:00 |
Message-ID: | 7892A37BDB5F4C7A9E09D3E4AB23DC5F@dell2 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
Andrus.
From | Date | Subject | |
---|---|---|---|
Next Message | Susan Cassidy | 2012-02-06 16:42:20 | Re: windows 2008 scheduled task problem |
Previous Message | Ralph Dell | 2012-02-06 16:26:11 | windows 2008 scheduled task problem |