First make sure, you have Crosstab available
CREATE EXTENSION tablefunc;
To get the crosstable you want you need at least three columns
eg:
name months amount
-------------------------
Helga Jan 100
Helga Feb 200
Bernd Jan 400
Then you create your Crosstable like this:
SELECT * FROM
crosstab('SELECT name, month, amount from temp')
AS ct(name varchar, jan int, feb int);
name jan feb
--------------------------
Helga 100 200
Bernd 400
If you are going to have columns for each month, stick to the example as described in the manual
create table sales(year int, month int, qty int);
insert into sales values(2007, 1, 1000);
insert into sales values(2007, 2, 1500);
insert into sales values(2007, 7, 500);
insert into sales values(2007, 11, 1500);
insert into sales values(2007, 12, 2000);
insert into sales values(2008, 1, 1000);
select * from crosstab(
'select year, month, qty from sales order by 1',
'select m from generate_series(1,12) m'
) as (
year int,
"Jan" int,
"Feb" int,
"Mar" int,
"Apr" int,
"May" int,
"Jun" int,
"Jul" int,
"Aug" int,
"Sep" int,
"Oct" int,
"Nov" int,
"Dec" int
);
year | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec
------+------+------+-----+-----+-----+-----+-----+-----+-----+-----+------+------
2007 | 1000 | 1500 | | | | | 500 | | | | 1500 | 2000
2008 | 1000 | | | | | | | | | | |
(2 rows)