What version of PostgreSQL are you running? The error seems to indicate
that you don't have the crosstab(text,text) form of the function.
In psql do:
contrib_regression=# \df crosstab
List of functions
Schema | Name | Result data type | Argument data types |
What version of PostgreSQL are you running? The error seems to indicate
that you don't have the crosstab(text,text) form of the function.
In psql do:
contrib_regression=# \df crosstab
List of functions
Schema | Name | Result data type | Argument data types |
On 11/1/10 11:54 PM, Stefan Schwarzer wrote:
SELECT * FROM
crosstab(
'SELECT name, year_start, value FROM foo ORDER BY 1',
'SELECT DISTINCT year_start FROM foo'
)
AS ct(name varchar, y_2010 float8, y_2011 float8);
Hi Joe. Thanks a lot for the suggestions. Tried it out, but same
I need to convert the integer values for the years into column names, i.e.
1965 into y_1965. How do I achieve this then?
Try something like:
create table foo (
name text,
year_start int,
value float8);
insert into foo values('a',2010,1.23),('b',2011,2.34);
SELECT * FROM
For one of the countries, I have a value for 2007, but not for 1960.
When using only the inner query, than I see one line: Andorra - 2007
- 539 But when running the whole SQL, the value for year 2007 get's
allocated to the year 1960. The table looks as follows:
name |y_1960|
For one of the countries, I have a value for 2007, but not for 1960.
When using only the inner query, than I see one line: Andorra - 2007
- 539 But when running the whole SQL, the value for year 2007 get's
allocated to the year 1960. The table looks as follows:
name |y_1960|
On 11/01/2010 06:24 AM, Stefan Schwarzer wrote:
I need to convert the integer values for the years into column names, i.e.
1965 into y_1965. How do I achieve this then?
Try something like:
create table foo (
name text,
year_start int,
value float8);
insert into foo