dbTalk Databases Forums  

[PG8.4] Problem with the number of columns in the output of a crosstab

comp.databases.postgresql comp.databases.postgresql


Discuss [PG8.4] Problem with the number of columns in the output of a crosstab in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Peca's
 
Posts: n/a

Default [PG8.4] Problem with the number of columns in the output of a crosstab - 01-20-2010 , 02:41 AM






Hi,
I created a crosstab function (query_sql, query_category) and it works,
but my query is dynamic and extracts a number of columns varies
according to the where clause. I studied the documentation and searched
the web but I found the solution. After the closing of the crosstab
feature in all the examples, the definition of the name and number in a
column is always static. Since I could pull out instead at least twenty
different results, what can I do?

Thanks for your help!

Reply With Quote
  #2  
Old   
Anselmo Canfora
 
Posts: n/a

Default Re: [PG8.4] Problem with the number of columns in the output of acrosstab - 01-20-2010 , 02:54 PM






Il 20/01/2010 9.41, Peca's ha scritto:
Quote:
Hi,
I created a crosstab function (query_sql, query_category) and it works,
but my query is dynamic and extracts a number of columns varies
according to the where clause. I studied the documentation and searched
the web but I found the solution. After the closing of the crosstab
feature in all the examples, the definition of the name and number in a
column is always static. Since I could pull out instead at least twenty
different results, what can I do?

Thanks for your help!
Hi, if you will read the output with Excel via ODBC you can generate raw
data using a cross join and then take advantage from pivot table feature
in Excel. I used to do so and report users are quite satisfied. Be aware
about row number limits, you have more than 2 millions as limit on Excel
2007 and Quattro Pro but only about 64k in Excel <= 2003.

Anselmo

Reply With Quote
  #3  
Old   
Peca's
 
Posts: n/a

Default Re: [PG8.4] Problem with the number of columns in the output of acrosstab - 01-20-2010 , 05:02 PM



Quote:
Hi, if you will read the output with Excel via ODBC you can generate raw
data using a cross join and then take advantage from pivot table feature
in Excel. I used to do so and report users are quite satisfied. Be aware
about row number limits, you have more than 2 millions as limit on Excel
2007 and Quattro Pro but only about 64k in Excel <= 2003.
Thanks, but I use PHP5 + postgresql8.4. I prefer to use only the
crosstab of PostgreSQL.

Reply With Quote
  #4  
Old   
Jasen Betts
 
Posts: n/a

Default Re: [PG8.4] Problem with the number of columns in the output of acrosstab - 01-24-2010 , 03:32 AM



On 2010-01-20, Peca's <abc (AT) efg (DOT) hi> wrote:
Quote:
Hi,
I created a crosstab function (query_sql, query_category) and it works,
but my query is dynamic and extracts a number of columns varies
according to the where clause. I studied the documentation and searched
the web but I found the solution. After the closing of the crosstab
feature in all the examples, the definition of the name and number in a
column is always static. Since I could pull out instead at least twenty
different results, what can I do?

Thanks for your help!
write a function that writes a function (or a query). And then in a
second query run the generated function (or query).

you can create functions in the temp schema if you don't want them to
clash with actions in other sessions.

What I normally do in that situation (you mention PHP later) is just
query the raw data sorted into a useful order (order by rowfield,
columnfield) and generate the crosstab using php with a couple
of while loops.

Jasen.

--- news://freenews.netfront.net/ - complaints: news (AT) netfront (DOT) net ---

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.