Schema names: "C_GT_Master","C_GT_Master". My table name is items.
Both schemas have the same table.
Fields: itemno, itemname, unitno.
I want to get details from items table in both schemas. Am using following code: 
SELECT stckreport.* FROM public.crosstab('select itemname, ''GT'' anal,
itemno from  "C_GT_Master".items i 
union all 
select itemname, ''UnitNo'' anal,unitno from  "C_GT_Master".items i 
union all 
select itemname, ''New'' anal,itemno from  "G_New_Master".items i  
union all 
select itemname, ''UnitNo'' anal,unitno from  "G_New_Master".items i 
','select ''GT'' union all select ''New'' union all select ''UnitNo''') 
as stckreport 
(itemname text,GT text,New Text,UnitNo text)
This query returns:
 itemname  gt  new unitno
   AB           1    
   AB                1
   AB       1          
   AB                2
But I want:
itemname  gt   new  unitno
 AB             1    1
 AB       1          2
How to get that result using crosstab(). My real problem in a project is too big, so I explain it using this one table.
Am using PostgreSQL 9.1.
 
     
     
    