Re: How to create crosstab with 3 values in every crosstab column
От | Andrus |
---|---|
Тема | Re: How to create crosstab with 3 values in every crosstab column |
Дата | |
Msg-id | 7892A37BDB5F4C7A9E09D3E4AB23DC5F@dell2 обсуждение исходный текст |
Ответ на | Re: How to create crosstab with 3 values in every crosstab column (Misa Simic <misa.simic@gmail.com>) |
Ответы |
Re: How to create crosstab with 3 values in every crosstab column
|
Список | 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 по дате отправления: