Re: [GENERAL] Subquery for column names of tablefunc crosstab queries

2011-02-07 Thread markw
Thanks Joe I'm very much learning as I go. I've followed your example from top to bottom - your sample code works - however its not clear to me how to execute the generate_crosstab_sql function to produce the results in one single step. I've tried this: CREATE OR REPLACE VIEW mycrosstabresults

Re: [GENERAL] Subquery for column names of tablefunc crosstab queries

2011-01-23 Thread Sim Zacks
What we have done in the past is dynamically build the crosstab query while getting the field names through another query. Then we select the query into a table and then select * from the table to get the result. Sim On 01/21/2011 07:34 PM, Julia Jacobson wrote: Thanks for your answer. The

Re: [GENERAL] Subquery for column names of tablefunc crosstab queries

2011-01-22 Thread Joe Conway
On 01/21/2011 09:34 AM, Julia Jacobson wrote: > Two further problems are the fact that the names of columns are not > allowed to begin with a number and every entry in the table definition > list must not only contain the name of the column but of course also a > data type (always the same - int).

Re: [GENERAL] Subquery for column names of tablefunc crosstab queries

2011-01-21 Thread Julia Jacobson
Thanks for your answer. The fact that the column definition list must be available to the parser was not obvious to me. Instead of building the second query dynamically in an application, I would prefer a user-defined function, because there will probably be several applications in need of it an

Re: [GENERAL] Subquery for column names of tablefunc crosstab queries

2011-01-21 Thread Joe Conway
On 01/21/2011 05:48 AM, Julia Jacobson wrote: > Having read the documentation of the tablefunc module, > I'm wondering whether it is possible to get the values for the names of > the columns for the crosstab query from a subquery. > A minimal example would look like this: > > CREATE TABLE mytable(

[GENERAL] Subquery for column names of tablefunc crosstab queries

2011-01-21 Thread Julia Jacobson
Hello everybody out there familiar with the tablefunc module, Having read the documentation of the tablefunc module, I'm wondering whether it is possible to get the values for the names of the columns for the crosstab query from a subquery. A minimal example would look like this: CREATE TABLE